DEV Community

Dezina
Dezina

Posted on

Javascript interview preparations

There are thousands of self-taught JavaScript programmers looking for web development positions. Unfortunately, self-learning or training classes, often leaves gaps in people’s understanding of the language itself. The problem is that questions testing your understanding of JS are exactly what many tech companies ask in their interviews. Some many know to do coding, but lack a solid grasp of the language. Just writing the some important concepts of js.

Shallow clone(copy) & deep clone(copy)

Shallow copy
copy the original object into the clone object then the clone object has the copy of the memory address of the original object. Means both points to the same memory address. A shallow copy means once we make changes in the clone object it will be reflected back to the original object as well.
_code:_
var obj1 = {
    id: 1,
    company: "GFG"
};
var obj2 = obj1;
obj2.id = 2;
console.log(obj1.id);
console.log(obj2.id);
_output:_
2
2

Deep copy
But in the case of deep copy, changing the value of the cloned object will not reflect into the original object, because the original object has its own reference object and after cloning, the cloned object has its own referenced object. Both are different.
_code:_
var student1 ={ 
    name : "Manish",
    company : "Gfg"

    }
    var student2 =  { ...student1 } ;
    student1.name = "Rakesh"
    console.log("student 1 name is",student1.name)
    console.log("student 2 name is ",student2.name);
_output_
student 1 name is Rakesh
student 2 name is  Manish
Enter fullscreen mode Exit fullscreen mode

Events

Browser events
Js events
Enter fullscreen mode Exit fullscreen mode

Value vs. Reference
Scope
Hoisting
Closures
this
new
apply, call, bind
Prototypes & Inheritance
Asynchronous JS
Higher Order Functions

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay