当前位置:网站首页>JS syntax usage
JS syntax usage
2022-08-05 08:21:00 【Eight ~ male】
JS output statement
alert('value') The browser pops up an alert box
console.log('value') browser console printout information
prompt('info') The browser pops up an input box, and the user enters
Variables in JS
1.1 What is a variable
A variable is a fast space allocated by a program in memory to store data.
The use of variables is divided into two parts: 1. Declaration of variables 2. Assignment
declare a variable
var age; //declare a variable named age
var is the js keyword, used to declare variables (meaning variable variables).After you declare a variable with a keyword, the computer automatically allocates space for the variable.
age: is the variable name defined by the programmer, and we allocate space through the variable name.
Variable assignment aeg=18
Output: console.log(age); or alert(age)
Declaring a variable without assignment will report undefined.
Using a variable without declaring or assigning a value will report an error: tel is not defined
js can be used without declaring variables and assigning them directly.
js data type
Data types are divided into simple and complex types
Simple data types (Number, string, Boolean, Undefined,null)
Complex data type (object)
Simple Data Type Description
Simple Data Types , Description , Default
Number Numeric, including integer and floating point 0
Boolean Boolean type true false Equivalent to 1 and 0 false
String
Undefined var a The declared variable is not assigned a value at this time a=undefined undefined
Null var=null declares that the variable a is empty
边栏推荐
- Three solutions to solve cross-domain in egg framework
- Redis缓存以及存在的问题--缓存穿透、缓存雪崩、缓存击穿及解决方法
- DataFrame insert row and column at specified position
- The color of life divine
- MySQL 数据库 报错 The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
- Controlling number and letter input in ASP
- 小本创业者的致胜法宝!
- Chapter 12 Bayesian Networks
- 星座理想情人
- P1103 书本整理
猜你喜欢
随机推荐
Qt writes custom controls: one of the text spotlight effects
SQL SERVER关于主从表触发器设计
MySQL 数据库 报错 The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
tear apart loneliness
Constellation ideal lover
[Structural Internal Power Cultivation] Structural Realization Stages (2)
CROS和JSONP配置
达梦数据库大表添加字段
DataFrame insert row and column at specified position
P1103 书本整理
php向mysql写入数据失败
egg框架中解决跨域的三种方案
uniapp时间组件封装年-月-日-时-分-秒
The toss of MM before going to the street (interesting)
作为一个男人必须明白的22个道理
D2--FPGA SPI接口通信2022-08-03
Why is pnpm hitting npm and yarn dimensionality reduction?
MySQL database error The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
[Repost] Marry a man must marry a man whose salary is at least 3571.4 yuan higher than yours
程序设计中的感悟









