//

Thursday, June 20, 2019

Basic concepts about JS

Motivation:


  • HTML and CSS only allow for static content
  • HTML/CSS do not allow for generating dynamic content that can change based on user input, activity, etc.
  • However, recall that the browser has an engine for generating dynamic content using JavaScript

The background of JS:

  • Developed at Netscape Communications in mid-1990s as a way of adding dynamic elements to HTML
  • Originally known as “LiveScript”; changed to “JavaScript” soon after its release
  • Now one of the most popular programming languages in the world

How to use JS:

  • JavaScript can be embedded directly in the HTML inside<script> tags and/or using <link> tags to external .js files
  • Browsers such as Chrome provide a JavaScript “REPL” console for writing and evaluating code (Can also see output generated by JavaScript in HTML )
  • You can also develop JavaScript in a .js file and execute it in a runtime environment such as Node.js 
Code example:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
This is my first JavaScript web page.
<p>
<script>
document.write('The current date and time is ');
var time = new Date();
document.write(time);

</script>
</body>
</html>

 Effect:







This is my first JavaScript web page.









Ref:

No comments:

Post a Comment

Effective Branching Strategies in Development Teams

Effective Branching Strategies in Development Teams Effective Branching Strategies in Developme...