top of page

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?


Ans. A global variable is a special kind of variable in JavaScript. This variable is easy to use and also available across the entire length of the JavaScript code. Mainly, the var keyword is used whether to declare a global or local variable.

Q5) What is the definition of the prompt box?


Ans. The Input provided by any user in the JavaScript is entered with the help of a prompt box. While putting forward the data or the input, the prompt box allows the user to do this with the help of a text box. To include the number, label box is also used.


Q6) Name the different types of groups of data types that are used in JavaScript and define them?


Ans. There are two basic groups of data types -

Reference type- These are complex types of data which can mainly include dates and strings.

Primitive type- These are the types of data that include numbers


Q7) Name the problems that are associated with the use of global variables?


Ans. Even though global variables are easy to use, these have some shortfalls. While using this type of variables, the problem of clashing of the variable names of different global and local scope occurs. The code that is often relied on the global variable also gets difficult to be tested and debugged.


Q8) Which Company developed JavaScript?


Ans. Netscape company had developed the JavaScript Programming Language.


Q9) What type of variables we use in JavaScript?


Ans. We use object data type variables in JavaScript.


Q10) What is mean by NULL in JavaScript?


Ans. If no value has been given to the variable then, it is called a null object (or) null value.


Q11) Which property is used to detect the operating system in cloud machine?


Ans. Navigator. platform String property is used to detect issues of the operating system in a cloud.


Q12) What are the pop-ups available in JavaScript?


Ans. The popups available in JavaScript are Alert, Prompt and Confirm.


Q13) What is the Different between Null and Undefined?


Ans. Both null and undefined have an empty value, but the difference between these two is:

In undefined case, we don't assign a value for the variable.

In the null case, we assign a zero value to the variable.


Q14) What are the ways used to read and write a file in JavaScript?


Ans. Two ways are available to read and write a file, they are:

JavaScript Expressions

Webpages and Active X objects


For further information: Please contact us:

+91 8218797122


14 views0 comments

Recent Posts

See All

Why we need node js to start Appium server?

If Appium tools are written in Node then you Need node to run it. If they were written in Python then you would need Python. If they were written in Java then you would need Java. You need a correct r

bottom of page