Javascript Interview Questions

These are just a few popular javascript questions that I repeatedly heard about.

Javascript Interview Questions
Photo by Peter Gombos / Unsplash

What is the difference between loose equals & strict equals?

Loose equals ( == ) allows coercion and returns true even if types are different.
Strict equals ( === ) does not allow coercion and only returns true when both the type and the value are the same.

What is JavaScript?

JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive.

What JavaScript Data Types do you know?

String
Boolean
Object
Undefined

What is the use of isNaN function?

isNaN function returns true if the argument is not a number; otherwise, it returns false.

What is 'this' keyword in JavaScript?

this refers to the object from where it was called.

Which symbol is used for comments in JavaScript?

// for single line comments

and

/*
    for multi line comments
*/

What is a closure in JavaScript?

A closure is an inner function that has acces to the variables in the outer (enclosing) function's scope chain. The closure has access to variables in three scopes: own, enclosing function and global.

What is JSON and its common operations?

JSON is a text-based data format following JavaScript object syntax. It is useful when you want to transmit data across a network.

What is the purpose of the array slice method?

The slice() method returns the selected elements in an array as a new array object. It selects the elements starting at the given start argument, and ends at the given optional end argument without including the last element. If you omit the second argument then it selects until the end.

What are lambda or arrow functions?

An arrow function is a shorter syntax for a function expression and does not have its own this, arguments, super or new.target. These functions are best suited for non-method functions, and they cannot be used as constructors.

Mastodon Romania