Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic grammars of JavaScript and how to use them

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the basic grammar of JavaScript and how to use it". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the basic grammars of JavaScript and how to use them?"

The combination of JavaScript basic grammar JS and HTML

1. Internal JS, we can define a tag in which the content is the js code, or anywhere in the HTML page, but it may affect the order of execution.

2. External JS, or define one to introduce external JS through the src attribute

Annotation

One-line comment: / / comment

Multiline comments: / * comment * /

Data type

Original data type:

Number: integer, decimal, NaN

String: string, regardless of single or double quotation marks

Boolean: Boolean value, true/false

Null: a placeholder with an empty object

Undefined: undefined, uninitialized variable defaults to undefined

Variable: var variable name = initialization value [xss_clean] (typeof (variable name)) / / the type of null is the object operator

Unary operator:

+ +-+ (plus sign)

Binary operator:

+-* /%

Assignment operator:

+ =-= * =

Comparison operator:

< >

= the same type direct comparison, different types converted to the same type after comparison = different types directly return false

Logical operator:

& & (and) | | () or! (non) have short-circuit effect

Ternary operator:

A > b? A b here, I believe you have a deeper understanding of "what is the basic grammar of JavaScript and how to use it". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report