What is console.log?

前端 未结 22 2334
面向向阳花
面向向阳花 2020-11-22 00:41

What is the use of console.log?

Please explain how to use it in JavaScript, with a code example.

22条回答
  •  情话喂你
    2020-11-22 01:17

    You use it to debug JavaScript code with either Firebug for Firefox, or JavaScript console in WebKit browsers.

    var variable;
    
    console.log(variable);
    

    It will display the contents of the variable, even if it is a array or object.

    It is similar to print_r($var); for PHP.

提交回复
热议问题