- Primitive data type
- Non-primitive (reference) data type
- Alert Box
- Confirm Box
- Prompt Box
DOM stands for Document Object Model, DOM: This consists of objects that have to deal with the currently loaded page, which is also called the document.
BOM stands for Browser Object Model. Unlike DOM, there is no standard defined for BOM, hence different browsers implement it in different ways. Typically, the collection of browser objects is collectively known as the Browser Object Model.
BOM is superset of DOM.
#Example: navigator, screen, location, frames,history, XMLHttpRequest etc
Even the document object (of the HTML DOM) is a property of the window object.
defer scripts are executed once the parser has finished it's job. defer scripts also gaurantees the order of execution in which they were added in page.
defer will download the file/script during HTML parsing, execute file/script only when the parser has finished it's job.
async scripts are executed as soon as the script is loaded. async scripts doesn't gaurantees the order of execution in which they were added in page.
async will download the file/script during HTML parsing, and halt the parser and execute the file/script and then again parser start it's job.
Strict mode is a new feature of ECMAScript 5 or ES5.
- It makes code debugging more easier.
- use strict enforces strict parsing and error handling.
- It is a good practice, developer should use - "use strict" mode.
- It is supported by all modern browsers.
You may also like - Node Js Interview Questions And Answers
- Single Line Comment: It is represented by double forward slash.
- Multi Line Comment: It is represented by forward slash with asterisk symbol.
The == operator checks values only whereas === checks values and data type.
The $(document).ready() event occurs as early as the HTML document start loading, while the window.onload event occurs later when all content (e.g. images etc.) has been loaded.
try lets you test a block of code for errors.
catch lets you handle the error.
throw lets you create custom errors.
finally lets you execute code, after try and catch, regardless of the result.
HTML DOM mouse events
By Array Literal
Example: var myArray = [value1,value2...valueN];
By creating Instance of Array
Example: var myArray = new Array();
By using an Array constructor
Example: var myArray = new Array('value1','value2',...,'valueN');
You can use unshift and push function
You can also use ES6 spread operator
You can use splice function add an element into an array at any specific postion.
The substr() function has the form substr(startIndex,length). It returns the substring from startIndex and returns length number of characters.
The substring() function has the form substring(startIndex,endIndex). It returns the substring from startIndex up to endIndex – 1.
Frames allow you to divide the page into several rectangular areas and to display a separate document in each rectangle. Each of those rectangles are called a "frame".
- Syntax Error
- Runtime Error
- Logic Error
You may also like - React Js Interview Questions and Answers
Ans: - 3030
Reason: 10 and 20 are integer, So they will be added numerically. And since 30 is a string, So it will be concat and final output will be 3030.
Ans: - 302010
Reason: Since 30 is a string which is at the starting of expression, So it will be concat with all later values so final output will be 302010.
false, becasue typeof null is object