Must see Examples


W3 schools provide most important web based functionalities please see the below link


JavaScript Interview Questions

1. what is ‘use strict’ ?

Strict mode makes it easier to write “secure” JavaScript.

Strict mode changes previously accepted “bad syntax” into real errors.

As an example, in normal JavaScript, mistyping a variable name creates a new global variable. In strict mode, this will throw an error, making it impossible to accidentally create a global variable.

In normal JavaScript, a developer will not receive any error feedback assigning values to non-writable properties means

What the MDN is referring to is the property prototype of Object itself. You cannot overwrite Object.prototype itself. If you try and make Object.prototype undefined, that will fail:

Object.prototype = 1;
console.log(Object.prototype); // [object Object]

If you try this in strict mode, you will get a TypeError upon attempting to assign to a non-writable property:

'use strict'; Object.prototype = 1; // TypeError: Cannot assign to read only property 'prototype' of function Object() { [native code] }

In strict mode, any assignment to a non-writable property, a getter-only property, a non-existing property, a non-existing variable, or a non-existing object, will throw an error.

for Ex:

  1. Using a variable, without declaring it, is not allowed:
"use strict";
x = 3.14;                // This will cause an error

2.  Deleting a variable (or object) is not allowed.

"use strict";
var x = 3.14;
delete x;                // This will cause an error

3. Deleting a function is not allowed.

"use strict";
function x(p1, p2) {}; 
delete x;                // This will cause an error

Continue reading

Difference Between in and hasOwnProperty in javascript

Let me explain you briefly

⊕ in:

basically its a keywork in javascript, it checks whether the  propreties there are not in the object as well as its prototype chain.

  1. If properties are there it returns true
  2. otherwise false.


⊕ hasOwnProperty: 

it is also a keyword in javascript, it checks for the prorperties only in the object itself but not its prototype chain.

  1. If properties are there it returns true
  2. otherwise false.

Note:  every object has prototype in javascript.

please refer the link below for more information

Difference Between in and hasOwnProperty in javascript


  • typeof “text”  —->   string
  • typeof 123   ——      number
  • typeof Nan  ——>  number
  • typeof “123”——>  string
  • typeof []——>  object
  • typeof {}——>  object
  • typeof null——>  object
  • typeof false——>  boolean
  • typeof true——>  boolean