1. What is JavaScript?
JavaScript is a client-side and server-side scripting language inserted into HTML pages and is understood by web browsers. JavaScript is also an Object-based Programming language
2. Enumerate the differences between Java and
JavaScript?
Java is a complete programming language. In contrast, JavaScript is a
coded program that can be introduced to HTML pages. These two languages are not
at all inter-dependent and are designed for different intent. Java is an
object-oriented programming (OOPS) or structured programming languages like C++
or C, whereas JavaScript is a client-side scripting language.
3. What are JavaScript Data Types?
Following are the JavaScript Data types:
- Number
- String
- Boolean
- Object
- Undefined
4. What is the use of isNaN function?
isNan function returns true if the argument is not a number; otherwise,
it is false.
5. Which is faster between JavaScript and an ASP
script?
JavaScript is faster. JavaScript is a client-side language,, and thus it
does not need the assistance of the webserver to execute. On the other hand,
ASP is a server-side language and hence is always slower than JavaScript.
Javascript now is also a server-side language (nodejs).
6. What is negative Infinity?
Negative Infinity is a number in JavaScript which can be derived by
dividing negative number by zero.
7. Is it possible to break JavaScript Code into
several lines?
Breaking within a string statement can be done by using a backslash,
‘\,’ at the end of the first line.
Example:
document. Write ("This
is \a program,");
And if you change to a new line when not within a string statement, then
javaScript ignores the break in the line.
Example:
var x=1, y=2,
z=
x+y;
8. What is ‘this’ keyword in JavaScript?
‘This’ keyword refers to the object from where it was called.
9. What is the working of timers in JavaScript?
Timers are used to execute a piece of code at a set time or repeat the
code in a given interval. This is done by using the functions setTimeout,
setInterval, and clearInterval.
10. What do you mean by the “===” operator?
This operator is called a strict equality operator.It returns true when
the two operands have the same value without having any type of conversion.
So, we could say that it is a strict equality operator which
returns false values are similar types.
11. Explain briefly how you
can submit a form using JavaScript?
In JavaScript, you can use an on click event for submitting a
form, i.e., form.submit() method.You can perform a submit action by using
submit button, By clicking on Hyperlinks.
For submitting a form using JavaScript use document.form[0].submit();
For Example:-document.form[0].submit();
12. How to detect the
operating system on the client machine?
if we want to detect the operating system on the client machine, then we
have to use navigator.appVersion or navigator.userAgent property.
13. What do you mean by
NULL in JavaScript?
The NULL is used to represent no-value or no-object.
It implies there shouldn’t be no object or null string, no valid
boolean value, no number, and no array object. The value will be nothing, or it
means null.
14. What is the use of the
delete operator?
The Delete keyword is used for deleting purposes. The delete keyword is
used to delete the property as well as its value also.
For Example:-
var student= {age:20,
batch:”ABC”};
delete student.age;
15. What do you mean by
undefined value in JavaScript?
First of all, an Undefined value means the variable used in the program
or code doesn’t exist, and another is the value that was not assigned and
property doesn’t exist, which is known as an Undefined value.
16. How can you read a
cookie in JavaScript?
By using our JavaScript concept we can read a cookie given below:-
var x =
document.cookie;
17. Explain what the
pop()method in JavaScript is?
The simple working of pop() method to removing the last element from an
array and returning that element, by working with this method, also changes the
length of the array.
The pop() method is acts similar to the shift() method.
The difference is that is the Shift() method works at the start of the
array, and also the pop() method takes the last element of the specified or
given array and returns it. After the array is called, it is altered.
For-Example:-
1 2 3 |
var cars = ["Audi", "BMW",
"Mercedes"]; cars.pop(); //Now cars become Audi, BMW. |
18. Is JavaScript contains
concept level scope?
The scope is the context on where the variables for functions can be
accessed, as you all write in Java and C, C++. I.e. defined by { }.
The concept level is otherwise known as block-level scope. As
JavaScript supports Function-level scope.
So, JavaScript does not have a concept-level scope.
Due to the variables declared inside or within the function have scope
inside the function.
19 What are the two primary
groups of data types in JavaScript?
The primary groups of data types JavaScript are mentioned below:-
1Primitive Types
2Reference Types
Primitive Types:-
Primitive types are number and Boolean type data types.
Reference Types:-
Reference types are the more complex types. It is like strings and
dates.
20. What is DOM?
DOM stands for Document Object Model.
When a web page is loaded, then the browser creates a Document
object model of that page.
The Document Object Model defines a standard or rules for accessing
documents on web pages.
21. What is the use of the Push method in
JavaScript?
The push method is used to add or append one or more elements to an
Array end. Using this method, we can append multiple elements by passing
multiple arguments.
22. What is the unshift method in JavaScript?
Unshift method is like the push method, which works at the beginning of
the array. This method is used to prepend one or more elements to the beginning
of the array.
23. What is the difference between JavaScript and
Jscript?
Both are almost similar. Netscape and Jscript develop JavaScript was
developed by Microsoft.
24. What is event bubbling?
JavaScript allows DOM elements to be nested inside each other. In such a
case, if the handler of the child is clicked, the handler of the parent will
also work as if it were clicked too.
25. Is JavaScript case sensitive? Give its example.
Yes, JavaScript is case-sensitive. For example, a function parseInt is
not the same as the function Parseint.
26. What boolean operators can be used in
JavaScript?
The ‘And’ Operator (&&), ‘Or’ Operator (||), and the ‘Not’
Operator (!) can be used in JavaScript.
*Operators are without the parenthesis.
27. Is JavaScript contains
concept-level scope?
The scope is the context on where the variables for functions can be
accessed, as you all write in Java and C, C++. I.e. defined by { }.
The concept level is otherwise known as block-level scope. As
JavaScript supports Function-level scope.
So, JavaScript does not have a concept-level scope.
Due to the variables declared inside or within the function have scope
inside the function.
28. What are the two
primary groups of data types in JavaScript?
The primary groups of data types JavaScript are mentioned below:-
1Primitive Types
2Reference Types
Primitive Types:-
Primitive types are number and Boolean type data types.
Reference Types:-
Reference types are the more complex types. It is like strings and
dates.
29. What is DOM?
DOM stands for Document Object Model.
When a web page is loaded, then the browser creates a Document
object model of that page.
The Document Object Model defines a standard or rules for accessing
documents on web pages.
30. What is the HTML DOM
model?
Simply, we can say that an HTML DOM is nothing but a defining standard
for how to get, change, delete, add HTML elements.
The HTML DOM is a standard object model and programming interface for
HTML.
0 Comments