JS Frequently Asked Questions

What is JavaScript??

JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.

What are the data types supported by JavaScript?

The data types supported by JavaScript are: Undefined, Null, Boolean, String, Symbol, Number, Object.

What is the difference between let, const and var?

Before ES6, JS had no way to support block-level scope variables. Now, we have: var for creating function-level scope variables, let for creating dynamic block-level scope variables and const for creating constant block-level scope variables.

Is JavaScript a case-sensitive language?

Yes, JavaScript is a case sensitive language. The language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.

What is Callback?

A callback is a plain JavaScript function passed to some method as an argument or option. It is a function that is to be executed after another function has finished executing, hence the name ‘call back‘. In JavaScript, functions are objects. Because of this, functions can take functions as arguments, and can be returned by other functions.

What is Closure?

Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope. It gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created. To use a closure, simply define a function inside another function and expose it.