DEV Community

Arya Krishna
Arya Krishna

Posted on

JavaScript Technical Interview Questions 1

Q. Inside the HTML document, where do you place your JavaScript code?

Inside the <head> element
In the <footer> element
Inside the <script> element
Inside the <link> element

Answer - Inside the <script> element

Q. What operator is used to assign a value to a declared variable?

Colon (:)
Equal sign (=)
Question mark (?)
Double-equal (==)

Answer - Equal sign (=)

Q. What are the six primitive data types in JavaScript?

  • string, number, boolean, bigInt, symbol, undefined
  • sentence, float, data, bigInt, symbol, undefined
  • string, num, falsy, bigInt, symbol, undefined
  • sentence, int, truthy, bigInt, symbol, undefined

Answer - `string, number, boolean, bigInt, symbol, undefined

Q. What is the difference between && and ||?


The logical operator && returns true if none of the expressions are true while the logical operator || returns true if one expression or the other returns true.


The logical operator && returns true if both expressions are true while the logical operator || returns true if one expression or the other returns true.


The logical operator && returns true if one expression is true while the logical operator || returns true if both expressions return true.


The logical operator && returns true if both expressions are true while the logical operator || returns false if one expression or the other returns true.

Answer -

The logical operator && returns true if both expressions are true while the logical operator || returns true if one expression or the other returns true.

Q. How do we declare a conditional statement in JavaScript?

for loop
while loop
if...else
difference...between

Answer -
if...else

Q. From the given array which index is the letter 'b' on? ['a', 'b', 'c', 'd']

0
3
2
1

Answer - 1

Q. How do we stop a loop from from repeating indefinitely?

  • We have to explicitly end the loop with the break keyword.
  • A loop will stop executing when the condition is true.
  • A loop will stop executing when the condition is false.
  • When we have iterated through half of the condition.

Answer - A loop will stop executing when the condition is false.

Top comments (0)