Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6706df0

Browse files
Update README.md
Added answers
1 parent 9de7b74 commit 6706df0

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

‎README.md‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,70 @@ Top JavaScript interview questions
2727
| 19 | [Difference between Call, apply, bind](#19-difference-between-call-apply-bind) |
2828

2929
### 1. What is JavaScript
30+
* JavaScript is the world's most popular programming language used for web development. It can be used to update HTML and CSS
31+
* Nowadays, JavaScript is getting used in many other areas e.g. server-side development, mobile app development etc.
3032

3133
### 2. What are the different data types in JavaScript
34+
| Primitive |Non-primitive |
35+
| ------------- | ------------- |
36+
| Boolean, NULL, undefined, BigInt, String, Number, Symbol | Object |
3237

3338
### 3. What are the different ways to create an Object in JavaScript
3439

40+
##### a) Object Literals: A comma-separated set of name and value pairs that is wrapped inside curly braces.
41+
42+
```
43+
var person = {
44+
name: 'Surbhi',
45+
age: 25,
46+
occupation: 'Software Engineer'
47+
}
48+
```
49+
##### b) Object.create method: TCreates a new object, by using an existing object as the prototype of the newly created object.
50+
51+
```
52+
const person = {
53+
name: 'Surbhi',
54+
age: 25,
55+
occupation: 'Software Engineer'
56+
}
57+
58+
var info = Object.create(person);
59+
console.log(info.name); // output - Surbhi
60+
61+
Here "person" is an existing object which is passed as a prototype to the newly created object "info"
62+
```
63+
64+
##### c) Object constructor: Constructor function allows to create objects with the help of new keyword
65+
66+
```
67+
const person = new Person();
68+
```
69+
70+
##### d) using ES6: We can create object using ES6 class feature
71+
72+
```
73+
class Person {
74+
constructor(name) {
75+
this.name = name;
76+
}
77+
}
78+
79+
let person = new Person('Surbhi');
80+
81+
console.log(person.name); //output - Surbhi
82+
```
83+
3584
### 4. Difference between "==" and "===" operators
85+
* == : While comparing two operands, checks for only value
86+
* === : While comparing two operands, checks for value as well as data type
3687

3788
### 5. Is javascript single-threaded or multi-threaded
89+
* JavaScript is Single-threaded
3890

3991
### 6. What are arrow functions and its features
4092

93+
4194
### 7. Explain passed by value and passed by reference
4295

4396
### 8. What do you mean by Synthetic events
@@ -51,6 +104,13 @@ Top JavaScript interview questions
51104
### 12. What are promises
52105

53106
### 13. Can we combine two arrays using any es6 operators
107+
* Yes, using Spread Operators
108+
```
109+
const arr1 = [1,2,3,4];
110+
const arr2 = [5,6];
111+
const arr3 = [...arr1, ...arr2]
112+
console.log(arr3) //output - [1,2,3,4,5,6]
113+
```
54114

55115
### 14. Difference between let, var, const
56116

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /