JAVASCRIPT Flashcards
a light-weight object-oriented programming language which is used by several websites for scripting the webpages.
JavaScript
It is an interpreted, full-fledged programming language that enables dynamic interactivity on websites when applied to an HTML document.
JavaScript
JavaScript was introduced in the year _____- for adding programs to the webpages in the Netscape Navigator browser.
1995
What are the features of JavaScript?
- All popular web browsers support JavaScript as they provide built-in execution environments.
- JavaScript follows the syntax and structure of the C programming language. Thus, it is a structured programming language.
- JavaScript is a weakly typed language, where certain types are implicitly cast (depending on the operation).
- JavaScript is an object-oriented programming language that uses prototypes rather than using classes for inheritance.
- It is a light-weighted and interpreted language.
- It is a case-sensitive language.
- JavaScript is supportable in several operating systems including, Windows, macOS, etc.
- It provides good control to the users over the web browsers.
the first popular web browser in 1993
Mosaic
In the year 1994, Netscape was founded by?
Marc Andreessen
in 1995 who implement and embed Scheme programming language to the browser?
Brendan Eich
JavaScript is used to create interactive websites. It is mainly used for?
Client-side validation,
Dynamic drop-down menus,
Displaying date and time,
Displaying pop-up windows and dialog boxes (like an alert dialog box, confirm dialog box and prompt dialog box),
Displaying clocks etc.
The ________ tag specifies that we are using JavaScript.
script
The _____________ is the content type that provides information to the browser about the data.
text/javascript
The _______________ function is used to display dynamic content through JavaScript.
document.write()
What are the 3 Places to put JavaScript code?
Between the body tag of html
Between the head tag of html
In .js file (external javaScript)
What is the output of this code?
<html>
<head>
<script> function msg(){ alert("Hello Javatpoint"); } </script>
</head>
<body>
<p>Welcome to JavaScript</p>
<form>
<input></input>
</form>
</body>
</html>
Welcome to Javascript
yna -> a button
and when you click “yna”
it will show “Hello Javatpoint” which is the message
True or False
We can create external JavaScript file and embed it in many html page.
True
True or False
External JavaScript file provides code re usability because single JavaScript file can be used in several html pages.
True
What are the advantages of external JavaScript?
- It helps in the reusability of code in more than one HTML file.
- It allows easy code readability.
- It is time-efficient as web browsers cache the external js files, which further reduces the page loading time.
- It enables both web designers and coders to work with html and js files parallelly and separately, i.e., without facing any code conflictions.
- The length of the code reduces as only we need to specify the location of the js file.
What are the disadvantages of external JavaScript?
The stealer may download the coder’s code using the url of the js file.
If two js files are dependent on one another, then a failure in one file may affect the execution of the other dependent file.
The web browser needs to make an additional http request to get the js code.
A tiny to a large change in the js code may cause unexpected results in all its dependent files.
We need to check each file that depends on the commonly created external javascript file.
If it is a few lines of code, then better to implement the internal javascript code.
meaningful way to deliver message. It is used to add information about the code, warnings or suggestions so that end user can easily interpret the code.
JavaScript comments
two advantages of JavaScript comments?
- To make code easy to understand
- To avoid the unnecessary code
a name of storage location.
JavaScript variable
two types of variables in JavaScript ?
local variable and global variable.
declared inside block or function. It is accessible within the function or block only
JavaScript local variable
accessible from any function. A variable i.e. declared outside the function or declared with window object
JavaScript global variable
two types of data types in JavaScript.
- Primitive data type
- Non-primitive (reference) data type
JavaScript is a______ ________ language
dynamic type
You need to use_____ here to specify the data type.
var
What are the primitive data types in JavaScript?
- String
- Number
- Boolean
- Undefined
- null
What are the non - primititive data type in JavaScript?
- Objects
- Array
- RegExp
represents instance through which we can access members
Objects
represents group of similar values
Array
represents regular expression
RegExp
types of operators in JavaScript.
Arithmetic Operators
Comparison (Relational) Operators
Bitwise Operators
Logical Operators
Assignment Operators
Special Operators