1-     What is JavaScript?

Javascript is a scripting language, which is everywhere come installed on every modern web browser, It helps to create really beautiful and crazy fast websites, It is also considered as an object-based programming language.

2-     What are the defined Data types in Javascript?

The different types of JavaScript data types are:

  • Boolean: Two possible values (true and false)
  • Number:  Integer, float point.
  • String   :   Double, single quotes, and backticks.
  • Object  :
  • Undefined

3-     Name the company that introduced JavaScript?

A company that proposed JavaScript is “Netscape” which is a software company.

Javascript-Interview-questions
updates javascript interview questions 2020

4-     How to read and write a file in JavaScript?

We can read and write a file in JavaScript by following two methods, they are

  • We can use JavaScript extension
  • file=fopen(getScriptPath(),0); The function fread() can be used for reading file contents
  • file = fopen(“c:\examplefile.txt”, 3); opens the file for writing.
  • str = fread(file,flength(file) ; The function fwrite() can used to write the contents to the file.

Also, read an extensive list of updated top JavaScript Interview Questions for more such answers.

5-    What is negative infinity?

Negativity Infinity is a number in javascript which can be derived by dividing negative number by zero.

6-  How to add new elements dynamically?

<html>

<head>

<title>Add</title>

<script type=”text/javascript”>

function addNode() { var newP = document.createElement(“p”); var textNode = document.createTextNode(” This is a new text node”);

newP.appendChild(textNode); document.getElementById(“firstP”).appendChild(newP); }

</script> </head>

<body> <p id=”firstP”>firstP<p> </body>

</html>

7- What is this keyword in JavaScript ?

There are four rules applies to this in order to know which object is referred by this keyword:

  1. Global Scope
  2. Object Method
  3. Call() or apply() method
  4. Blind() method

Conclusion

Well, I am wrapping up with this. You can read these questions that will surely help you to crack your interview. Get top 30 JavaScript interview questions for more read