Basic JavaScript interview Questions

Q1) What is JavaScript?


Ans. JavaScript is a scripting language used for programming web pages as well as server systems. It is an object-oriented, interpreted, lightweight and powerful programming language, made up of first-class functions. The JavaScript can update the content dynamically for web pages.


Q2) What are the differences between JavaScript and Java?


Ans. Java is an object-oriented and structured programming language, which help to run web pages on different platforms. The java code should be compiled on the compiler. JavaScript is an object-oriented scripting language. In which, the scripts are optimized for both server and client side. Javascript is introduced to perform HTML pages.


Q3) Name the different types of JavaScript data?


Ans. JavaScript data are of the following types -

String

Function

Boolean

Object

Number

Null


Q4) What is the definition of global variables? In what way, these variables are declared?