How to print error message to console (Press F12 to view the message) in JavaScript

2 Answers

0 votes
let message = "Error message"; 

console.error(message);

    
    
    
/*
run:
    
Error message
    
*/

 



answered Feb 2, 2021 by avibootz
edited Feb 2, 2021 by avibootz
0 votes
let a = 84745;

console.error('a = %d', a);

    
    
    
/*
run:
    
a = 84745
    
*/

 



answered Feb 2, 2021 by avibootz

Related questions

...