当前位置:网站首页>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
边栏推荐
猜你喜欢
数据源对象管理Druid和c3p0
Jmeter永久设置中文界面
JVM运行流程,运行时数据区,类加载,垃圾回收,JMM解析
Ethernet Principle
The Coolest Kubernetes Network Solution Cilium Getting Started Tutorial
Ethernet Principle
Redis cache and existing problems--cache penetration, cache avalanche, cache breakdown and solutions
Chapter3、色调映射
unity urp 渲染管线顶点偏移的实现
Embedded Systems: Basic Timers
随机推荐
力扣每日一题
Basic introduction of stack and queue and C language implementation of functions such as creation, destruction, entry and exit, counting the number of elements, viewing elements, etc., as well as stac
Why is pnpm hitting npm and yarn dimensionality reduction?
链表专项之环形链表
uniapp time component encapsulates year-month-day-hour-minute-second
树状数组模版+例题
Iptables implementation under the network limited (NTP) synchronization time custom port
手机上流行的各类谜语
pnpm 是凭什么对 npm 和 yarn 降维打击的
宝塔实测-搭建中小型民宿酒店管理源码
v-if/v-else determines whether to display according to the calculation
基于多块信息提取和马氏距离的k近邻故障监测
国际原子能机构总干事称乌克兰扎波罗热核电站安全形势堪忧
Chapter 12 Bayesian Networks
【无标题】长期招聘硬件工程师-深圳宝安
Moonbeam团队发布针对整数截断漏洞的紧急安全修复
[Untitled] Long-term recruitment of hardware engineers-Shenzhen Baoan
egg框架中解决跨域的三种方案
spark集群部署(第三弹)
Data source object management Druid and c3p0