-
What is the output of “10”+20+30 in JavaScript?
102030 because after a string all the + will be treated as string concatenation operator (not binary +).
-
What is the output of 10+20+”30″ in JavaScript?
3030 because 10+20 will be 30. If there is numeric value before and after +, it treats as binary + (arithmetic operator).
-
What does the isNaN() function?
The isNan() function returns true if the variable value is not a number. For example:
-
How to create an array in JavaScript?
There are 3 ways to create an array in JavaScript. Let’s see a simple code to create an array using object literal.
-
How to create objects in JavaScript?
There are 3 ways to create an object in JavaScript. Let’s see a simple code to create an object using object literal.
-
How to write normal text code using JavaScript dynamically?
The innerText property is used to write the simple text using JavaScript dynamically. Let’s see a simple example:
-
How to write HTML code dynamically using JavaScript?
The innerHTML property is used to write the HTML code using JavaScript dynamically. Let’s see a simple example:
-
What is the difference between == and ===?
The == operator checks equality only whereas === checks equality, and data type, i.e., a value must be of the same type.
-
What are the different data types present in JavaScript?
There are two types of data types in JavaScript: Primitive data types The primitive data types are as follows: String: The string data type represents a sequence of characters. It is written within quotes and can be represented using a single or a double quote. Example: Number: The number data type is used to represent numeric values…
-
How to create a function in JavaScript?
To create a function in JavaScript, follow the following syntax.