What is Console.log in Javascript/Jquery and when to use it?

Now a days developers are using client side scripting for many purpose.There are lots of advantages using to use it.But some times it  comes with lots of bugs and challenges.

So obviously to solve bugs/conflits we need to debug our code, here console.log or javascript alert comes into picture.
To bebug or to show the error log/ or any log we use console.log method  to log the information in browser console window.

console.log() just takes whatever you pass to it and writes it to a console's log window. If you pass in an array, you'll be able to inspect the array's contents.

Below example will write a  sentence ("Hey codi bucket, i have perform click event") in  browser console screen.

$( '#buttonID' ).click ( function () {
  console.log ( 'Hey codi bucket, i have perform click event' );
  // do something
} );

Hope you like the tutorial.

Thanks.
What is Console.log in Javascript/Jquery and when to use it? What is Console.log in Javascript/Jquery and when to use it? Reviewed by CodiBucket on 10:45 Rating: 5

No comments:

Facebook

Powered by Blogger.