DEV Community

Cover image for 19 JavaScript Questions I Have Been Asked Most In Interviews

19 JavaScript Questions I Have Been Asked Most In Interviews

arnabroychowdhury on April 25, 2022

Being a fresher it’s a lot difficult to prepare for an interview. You will have very little idea and experience regarding their requirements, what ...
Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Your anonymous function example is not an anonymous function. Try:

console.log(display.name)  // 'display'
Enter fullscreen mode Exit fullscreen mode

Yes, it has a name. It's not anonymous

You're also missing 2 data types - BigInt and Symbol

I'm also curious where you're interviewing, as this interview technique is a pretty poor way to see if someone is a good developer

Collapse
 
nahueldev profile image
Nahuel

"Everything is an object"
No, primitives aren't object.

Collapse
 
merthod profile image
Merthod

Primitives are called that basically because they are represented as is in the underlying C++ code, or bytecode.

But in JS, everything is an object. undefined, for example is a property that lives in the window object of a browser. Naturally, in JS primitives are wrapped in their [forgot the ECMA-naming-convention] object. But as long as you assign a primitive to a variable or use () or return it (thus wrapping it in an object), it becomes an object on its own automatically because of the prototypical nature of the language.

Collapse
 
sachininsuredmine profile image
sachin-insuredmine

yeah but they are wrapped in object

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Yep, you can add methods to numbers

Collapse
 
sloan profile image
Sloan the DEV Moderator

Hi there, it appears that this post contains affiliate links. We ask that posts including affiliate links also contain a clear disclaimer so that readers are aware. Here is some suggested language:

This post includes affiliate links; I may receive compensation if you purchase products or services from the links provided in this article.

Collapse
 
1596944197 profile image
梅一一

is ok

Collapse
 
bokomoko profile image
João Eurico "Bokomoko" Lima

There are more than 2 types of scope.
Global, Local and block

Collapse
 
bluemont profile image
Bluemont

Thanks - from a newbie who is preparing for the first interview, this is helpful. Folks have pointed out flaws in your example code, but the most helpful thing is the list of topics, which I can go back and research from MDN and other sources.

Collapse
 
1saifj profile image
Saif Aljanahi

Thanks for sharing this with us

Collapse
 
danteahmed profile image
Mehedi Hassan

the self promotion was bit too much! it got me distracted several times!
try to avoid putting these ads at middle of the reading part!

Collapse
 
dren0r123 profile image
Anton
  • What is a Scope and How Many are There?
  • There are 2 types

it's not right. Almost 7 years js has Function scope and "let" keyword

Collapse
 
puritanic profile image
Darkø Tasevski

Can you please add some disclaimer to the post, regarding the LambdaTest ads?