0% found this document useful (0 votes)
5 views

JavaScript Interview Question With Answer

Uploaded by

jji732598
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

JavaScript Interview Question With Answer

Uploaded by

jji732598
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Javascript Interview

Questions with
Answer

Hassan Mujtaba | Full Stack Developer


@javascriptwithhassan
Why "use strict" is used in
JavaScript?
'Use strict' is used in JavaScript to make sure
that your code is written correctly.
Strict mode enforces the following list:
Variables must be declared before they are
used
All comparisons must be done between
literal values
No function calls can be made until the
function has been defined.
This helps to catch errors early on in the
development process and keeps your code
more organised.

Hassan Mujtaba | Full Stack Developer


@javascriptwithhassan
What is an anonymous
function?
An anonymous function is a function that
doesn't have a name. This is important because
it allows the function to be called without
having to specify the function's name.

This is useful when you want to keep the code


secret.

This type of function is often used to create


short, convenient code snippets.

Hassan Mujtaba | Full Stack Developer


@javascriptwithhassan
What is the hoisting in
JavaScript?
Hoisting simply means that all declarations are
lifted to the top of the scope, which may have
them declared before or after other codes.

This means that even if you declare your


variable after some other code, it will be
available at the top of that scope - making it
accessible outside of its original location.

(Explained full answer in interview kit)

Hassan Mujtaba | Full Stack Developer


@javascriptwithhassan
What is memorization?

Memoization is a storage technique that is


designed to speed up computer programs.

A program memorizes the output of an


expensive function, so if it requires this output
again, it will not have to run that function again
but instead just call its stored value.

Memoization in JavaScript depends on a


combination of two concepts:
1. Closures
2. Higher order functions

Hassan Mujtaba | Full Stack Developer


@javascriptwithhassan
What is the difference between
functions and methods?
The major difference between methods and
functions in JavaScript is that methods are
called on objects while functions are not.

Methods are called on objects with a dot


operator while functions are called using
parentheses.

The method accepts arguments through an


object parameter, and the function accepts
arguments through a parenthesis parameter.

Hassan Mujtaba | Full Stack Developer


@javascriptwithhassan
Do you find it helpful?
Let me know in the comment section

Hassan Mujtaba | Full Stack Developer

Follow for more tips and tricks related to


web development

You might also like