- Easy to use and learn.
- Easily expandable.
- Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)
- Easy to use for DOM manipulation and traversal.
- Large pool of built in methods.
- AJAX Capabilities.
- Methods for changing or applying CSS, creating animations.
- Event detection and handling.
- Tons of plug-ins for all kind of needs.
Tag Archives: Javascript
Javascript Undeclared And Undefined Variables
Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered.
Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.
JavaScript Undefined Value
Undefined value means the
- Variable used in the code doesn’t exist
- Variable is not assigned to any value
- Property doesn’t exist
Javascript Print Text On Tthe Screen
document.write(“Welcome”) is used to print the text – Welcome in the screen.
Javascript Typeof
‘Typeof’ is an operator which is used to return a string description of the type of a variable.
JavaScript innerHTML Disadvantages
- Content is replaced everywhere
- We cannot use like “appending to innerHTML”
- Even if you use +=like “innerHTML = innerHTML + ‘html’” still the old content is replaced by html
- The entire innerHTML content is re-parsed and build into elements, therefore its much slower
- The innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it
JavaScript pop() Method
The pop() method is similar as the shift() method but the difference is that the Shift method works at the start of the array. Also the pop() method take the last element off of the given array and returns it. The array on which is called is then altered.
JavaScript Cookies
Cookies are the small test files stored in a computer and it gets created when the user visits the websites to store information that they need. Example could be User Name details and shopping cart information from the previous visits.
JavaScript Escape Characters
Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.
JavaScript Data Type Of Variables
All variables in the JavaScript are object data types.