Monday, August 10, 2020

JavaScript

 

JavaScript Display Possibilities


JavaScript can "display" data in different ways:

  • Writing into an HTML element, using innerHTML.
  • Writing into the HTML output using document.write().
  • Writing into an alert box, using window.alert().
  • Writing into the browser console, using console.log().

JavaScript Values

The JavaScript syntax defines two types of values: Fixed values and variable values.

Fixed values are called literals. Variable values are called variables.


JavaScript Literals

The most important rules for writing fixed values are:

Numbers are written with or without decimals:



JavaScript Variables


In a programming language, variables are used to store data values.

JavaScript uses the var keyword to declare variables.

An equal sign is used to assign values to variables.

In this example, x is defined as a variable. Then, x is assigned (given) the value 6:





No comments:

Post a Comment

Latest post

JSON

  What is JSON? JSON stands for  J ava S cript  O bject  N otation JSON is a lightweight data-interchange format JSON is "self-describi...