Variable typing is used to assign a number to a variable and the same variable can be assigned to a string.
All posts by Pramod T P
Javascript Event Bubbling
JavaScript allows DOM elements to be nested inside each other. In such a case, if the handler of the child is clicked, the handler of parent will also work as if it were clicked too.
Javascript Difference Between .call() And .apply()
The function .call() and .apply() are very similar in their usage except a little difference. .call() is used when the number of the function’s arguments are known to the programmer, as they have to be mentioned as arguments in the call statement. On the other hand, .apply() is used when the number is not known. The function .apply() expects the argument to be an array.
The basic difference between .call() and .apply() is in the way arguments are passed to the function.
Javascript Closures
Closure is a locally declared variable related to a function which stays in memory when the function has returned.
Javascript window.onload and onDocumentReady
The onload function is not run until all the information on the page is loaded. This leads to a substantial delay before any code is executed.
onDocumentReady loads the code just after the DOM is loaded. This allows early manipulation of the code.
Javascript Hide Codes
For hiding JavaScript codes from old browsers:
Add “<!–” without the quotes in the code just after the <script> tag.
Add “//–>” without the quotes in the code just before the <script> tag.
Old browsers will now treat this JavaScript code as a long HTML comment. While, a browser that supports JavaScript, will take the “<!–” and “//–>” as one-line comments.
Javascript decodeURI() And encodeURI()
EncodeURl() is used to convert URL into their hex coding. And DecodeURI() is used to convert the encoded URL back to normal.
Javascript unescape() And escape() Functions
The escape () function is responsible for coding a string so as to make the transfer of the information from one computer to the other, across a network.
The unescape() function is very important as it decodes the coded string.
Javascript Screen Objects
Screen objects are used to read the information from the client’s screen. The properties of screen objects are
- AvalHeight: Gives the height of client’s screen Gives the width of client’s screen.
- ColorDepth: Gives the bit depth of images on the client’s screen
- Height: Gives the total height of the client’s screen, including the taskbar
- Width: Gives the total width of the client’s screen, including the taskbar
Javascript Functional Components
The different functional components in JavaScript are-
First-class functions: Functions in JavaScript are utilized as first class objects. This usually means that these functions can be passed as arguments to other functions, returned as values from other functions, assigned to variables or can also be stored in data structures.
Nested functions: The functions, which are defined inside other functions, are called Nested functions. They are called ‘everytime’ the main function is invoked.