Home  >  Article  >  Web Front-end  >  What is javascript syntax

What is javascript syntax

藏色散人
藏色散人Original
2021-07-02 11:30:313390browse

JavaScript syntax is a set of rules that defines the language structure of JavaScript; JavaScript is a scripting language and a lightweight but powerful programming language.

What is javascript syntax

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

What is the syntax of javascript?

JavaScript syntax is a set of rules that defines the language structure of JavaScript.

var x, y;// 如何声明变量
x = 7; y = 8;// 如何赋值
z = x + y;// 如何计算值

JavaScript Values

JavaScript statements define two types of values: mixed values ​​and variable values.

Mixed values ​​are called literals. Variable values ​​are called variables.

JavaScript literals

The most important rule for writing mixed values ​​is:

You can write values ​​with or without a decimal point:

15.90
10011

A string is text, surrounded by double or single quotes:

"Bill Gates"
'Bill Gates'

JavaScript Variables

In programming languages, variables are used to store data values.

JavaScript uses the var keyword to declare variables. The

= sign is used to assign a value to a variable.

In this example, x is defined as a variable. Then, the value assigned to x is 7:

var x;
x = 7;

For a more detailed introduction to JavaScript syntax, please visit the "javascript Syntax" chapter in the manual.

The above is the detailed content of What is javascript syntax. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn