JAVA SCRIPT DAY 1 (JS Development Tools, syntax,)



JavaScript DAY - 1
What is JavaScript?
Ø  JavaScript (JS) is a lightweight, dynamic computer programming languageand designed for creating network-centric applications.
Ø  It is most commonly used as a part of web pages, whose implementations allow client-side script to interact with the user and make dynamic pages.
Ø  It is an interpreted programming language with object-oriented capabilities.
Ø  JavaScript was first known as LiveScript, but Netscape changed its name to JavaScript, possibly because of the excitement being generated by Java. JavaScript made its first appearance in Netscape 2.0 in 1995 with the name LiveScript. The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.
Ø  It is open and cross-platform.

Immediately

Advantages of JavaScript

The merits of using JavaScript are −
Ø Less server interaction                               − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.
Ø Immediate feedback to the visitors           − They don't have to wait for a page reload to see if they have forgotten to enter something.
Ø Increased interactivity                                − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.
Ø Richer interfaces                                        − You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.

 

Limitations of JavaScript

We cannot treat JavaScript as a full-fledged programming language. It lacks the following important features −
Ø 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 multithreading or multiprocessor capabilities.

 

JavaScript Development Tools

Ø  Text editor such as Notepad.
Ø  Any web browser as a compiler.

 

JavaScript Script Syntax

Ø  JavaScript can be implemented using JavaScript statements that are placed within the <script>... </script> HTML tags in a web page.
Ø  Normally<script> tags should keep within the <head> tags.
Ø  The <script> tag alerts the browser program to start interpreting all the text between these tags as a script.
Ø  The script tag takes two important attributes −
1.    Language − This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.
2.    Type − This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".
<html>
<body>
<scriptlanguage="javascript"type="text/javascript">
            <!--
document.write("Hello World!");
            // - ->
</script>
</body>
</html>

 

Ø  JavaScript is case sensitive. Keywords are lowercase but variables can be mixed of lower and uppercase characters like myVal.
Ø  // is used for single line comment and /*  */ are used for multiline comments.JavaScript also recognizes the HTML comment opening sequence <!- - and the closing sequence should be written as //-->.
Ø  Semicolons are used to terminate the statements but are optional. It is a good programming practice to use semicolons.
Ø  JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs.
Ø  The function document.write which writes a string into our HTML document. This function can be used to write text, HTML, or both.


Practical
Write a JavaScript code to display the text “Welcome to Home” and run it.

No comments:

Post a Comment

Give your valuable feedback

Topic :Software & Types, Subject: Computer Fundamental Notes for CSJM University Kanpur(for different courses like BBA, BCA, etc..)

Software Software refers to the programs, data, and instructions that enable a computer or other digital device to perform specific tasks or...