当前位置:网站首页>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
边栏推荐
- SVG Star Wars Style Toggle Toggle Button
- sql server收缩日志的作业和记录,失败就是因为和备份冲突了吗?
- Spark cluster deployment (third bullet)
- DPU — 功能特性 — 网络系统的硬件卸载
- Stored procedure writing experience and optimization measures
- 青苹果论坛重新开放
- Insights in programming
- DataFrame在指定位置插入行和列
- Controlling number and letter input in ASP
- 七夕给自己new一个chatRobot当对象
猜你喜欢

TensorFlow installation steps

ps怎么替换颜色,自学ps软件photoshop2022,ps一张图片的一种颜色全部替换成另外一种颜色

unity 头发的渲染

【结构体内功修炼】枚举和联合的奥秘(三)

Support touch screen slider carousel plugin

Pagoda measurement - building small and medium-sized homestay hotel management source code

SQL语句查询字段内重复内容,并按重复次数加序号

链表专项之环形链表

Fiddler工具讲解

Chapter 12 Bayesian Networks
随机推荐
【结构体内功修炼】枚举和联合的奥秘(三)
RedisTemplate: 报错template not initialized; call afterPropertiesSet() before using it
长期招聘嵌入式开发-深圳宝安
Chapter 12 贝叶斯网络
[Structure internal power practice] Structure memory alignment (1)
Luogu P1908: 逆序对 [树状数组]
SVG Star Wars Style Toggle Toggle Button
Walk 100 trick society
Detailed explanation of DNS query principle
【结构体内功修炼】结构体内存对齐(一)
网页直接访问链接不让安全中心拦截
Nn. Unfold and nn. The fold
SVG星球大战样式Toggle切换开关按钮
Redis cache and existing problems--cache penetration, cache avalanche, cache breakdown and solutions
EA谈单机游戏:仍是产品组合中极其重要的部分
【每日一题】1403. 非递增顺序的最小子序列
Jmeter永久设置中文界面
spark集群部署(第三弹)
Fiddler工具讲解
512色色谱图