JAVASCRIPT Flashcards
It is lightweight and most commonly used as a part of web pages, whose implementations allow client-side script to interact with the user
and make dynamic pages.
JavaScript
- It is complimentary to and integrated with Java. A very easy to implement because it is integrated with HTML. It is open and cross-platform.
-a dynamic computer programming language.
JavaScript
Why to Learn Javascript?
- Javascript is the most popular programming language in the world and that makes it a programmer’s great choice
-Javascript is everywhere, it comes installed on every modern web browser and so to learn Javascript you really do not need any special environment setup - Javascript helps you create really beautiful and crazy fast websites.
- JavaScript usage has now extended to mobile app development,desktop app development, and game development.
What is the output of this?
<html>
<body>
<script> document.write("Hello World!") </script>
</body>
</html>
Hello World!
Enumerate the applications of JavaScript Programming
- Client side validation
- Manipulating HTML Pages
- User Notifications
- Presentations
- Server Applications
- Back-end Data Loading
the most common form of the language.
The script should be included in or referenced by an HTML document for the code to be interpreted by the browser.
Client-side JavaScript
True or False
The JavaScript code is executed when the user submits the form, and only if all the entries are valid, they would be submitted to the Web Server.
True
True or False
JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user initiates explicitly or implicitly.
True
Enumerate the Advantages of JavaScript
- Less server interaction
- Immediate feedback to the visitors
- Increase interactivity
- Richer interfaces
You can validate user input before sending the page off to the server.
Less server interaction
They don’t have to wait for a page reload to see if they have forgotten to enter something.
Immediate feedback to the visitors
You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.
Increased interactivity
You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.
Richer interfaces
What are the limitations of JavaScript
-Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason
-JavaScript cannot be used for networking applications because there is no such support available.
-JavaScript doesn’t have any multi-threading or multiprocessor capabilities.
True or False
- JavaScript can be implemented using JavaScript statements that are placed within the
...
HTML tags in a web page.
True
True or False
You can place the
tags, containing your JavaScript, anywhere within your web page, but it is normally recommended that you should keep it within the <head> tags.
True
Enumerate the two important attributes in script tags
-Language
- Type
This attribute specifies what scripting language you are using. Typically, its value will be JavaScript.
Language
This attribute is what is now recommended to indicate the scripting language in use and its value should be set to “text/javascript”.
Type
JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs.
Whitespace and Line Breaks
Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java.
Semicolons are Optional
JavaScript is a _______________ language. This means that the language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
case-sensitive / case sensitivity
What is the comment in JavaScript?
// and /* */
What is the external file from HTML to JavaScript?
what three primitive data types allow you to work with JavaScript?
➢ Numbers, eg. 123, 120.50 etc.
➢ Strings of text e.g. “This text string” etc.
➢ Boolean e.g. true or false.
JavaScript also defines two trivial data
types,_____ and _______ , each of which defines only a single value.
null and undefined
True or False
JavaScript supports a composite data type known as object.
True
True or False
-Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows.
True
True or False
Storing a value in a variable is called variable initialization. You can do variable initialization at the time of variable creation or at a later point in time when you need that variable
<script> var name = "Ali"; var money; money = 2000.50; </script>
True
True or False
- Use the var keyword only for declaration or initialization, once for the life of any variable name in a document. You should not re- declare same variable twice.
-JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type.
True
True or False
-Unlike many other languages, you don’t have to tell JavaScript during variable declaration what type of value the variable will hold.
- The value type of a variable can change during the execution of a program and JavaScript takes care of it automatically.
True
What are the variable scope in JavaScript?
-Global variables
- Local Variables
it can be defined anywhere in your JavaScript code.
Global Variables
The variable that will be visible only within a function where it is defined. Function parameters are always local to that function.
Local Variables
Enumerate the JavaScript operator
- Arithmetic Operators
- Comparison Operators
- Logical (or Relational) Operators
- Assignment Operators
- Conditional (or ternary) Operators