Javascript Archive

How to Prevent Javascript Error When Using console.log in Internet Explorer

Whenever I code some Javascript, for debugging purpose I’m using console.log statement. It runs well on my Chrome and Firefox (with Firebug add-on installed). But when it comes to Internet Explorer, my script will throws some exceptions. The new version of Internet Explorer is bundled with Developer Tools (by pressing F12 button). When the

How to Pass Function Name as Variable in Javascript

Imagine that we have a javascript function named functionCaller that accept function name as its parameter. Let’s call it callBackFunction. Then, from the inside of functionCaller, we will call the callBackFunction. function callBackFunction() { alert("I'm the callBackFunction.."); } var functionCaller = function(functionName) { functionName(); } functionCaller(callBackFunction); Look at how we call the functionCaller. Just