当前位置:网站首页>JS -- first understand the naming rules and data types of JS and variables
JS -- first understand the naming rules and data types of JS and variables
2022-07-27 02:09:00 【Bonsoir777】
Preface
From today on, I will open a new JS series , And will continue to update , If it can help you a little bit in front of the screen , I will be very happy ~( In this paper, Js Variables section in )
One 、 What is? JS?
- JS(JavaScript)
A scripting language originally developed by Netscape ,
- JS Component part
- ECMAScript
It defines the basic syntax and basic objects of the script language , Now every browser has low ECMAScript The implementation of the
2.DOM(Document Object Model)
Document object model , In the browser DOM Solidify the whole web page into a tree structured document composed of node levels ,3
3.BOM(Broswer Object MOdel)
Browser object model , Describes the method and interface of accessing and operating the browser window .
- JS Basic usage
1. Inline : take js The code is written directly inside the label
<a href="javascript:alert(' Click on me ');"> You order me too </a>
2. embedded : take JS The code is written in script In the label , Written in head Medium or body in
3. Outer chain : take script The label is written in an external file ,script Once the label is introduced outside js file , You can't write code anymore , You need to recreate a script Tags are used to write internal code , for example :
,<script src="./01.js"></script>
Two 、 Variable
1. Declaration of variables
- Use var Keyword declared variables , Will be declared before all code is executed ( But no assignment )
- But if you don't use var keyword , Then the variable will not be declared in advance ,
var a=123;
2. Identifier naming rules
- It can contain letters , Numbers , Underline ,$
- Cannot start with a number
- It can't be ES Keywords or reserved words in
- Generally, hump is named ( Initial lowercase , Capitalize the beginning of each word , The rest of the letters are lowercase xxxZzzYyy)
3. data type
var obj3 = new Object( );var obj4 = new Object( );
3.1 character string string
- Use quotation marks to express as a string
- Single quotation marks , And double quotation marks cannot be mixed
- Quotation marks cannot be nested , Double quotation marks can't be put in double quotation marks , You can't put a single quote
- have access to \ Character escape
- \'' Express ''
- \' Express '
- \n Means line break
- \t Generate tabs , It's equivalent to pressing once tab key
- \\ Express \
3.2 The number number
3.3 Boolean value
summary
That's what I want to share today , Beginners JS Are some basic grammatical parts , But it is the foundation of future learning , Beginners of front-end students must take it seriously . Finally, I still see your peace and happiness in front of this screen , Health and happiness , Wish you and me ~
边栏推荐
- Pseudo class of a element
- Mysql数据库-面试题
- MySQL view
- [FPGA tutorial case 30] DDS direct digital frequency synthesizer based on FPGA -- frequency accuracy analysis with MATLAB
- [cann training camp] enter media data processing 1
- Realize data interaction between two apps through fileprovider
- count(*)为什么很慢
- mysql的安装
- MySQL stored procedure function
- MySQL主从复制与读写分离
猜你喜欢
随机推荐
Installation and basic operation of docker
MVCC及其原理详解
Removal and addition of reference types in template and generic programming
mysql一个select语句的执行过程
Homework 1-4 learning notes
count(*)为什么很慢
Virtualization technology KVM
QoS quality of service - QoS overview
shell课程总结
Docker advanced: detailed explanation of MySQL master-slave replication and redis cluster capacity expansion and reduction configuration cases
科学计算库 —— Matplotlib
Introduction to network - Introduction to Enterprise Networking & basic knowledge of network
How can smart people leave without offending others?
[详解C语言]一文带你玩转选择(分支)结构
ACM模式输入输出练习
24ssh service
Docker高级篇之Mysql主从复制、Redis集群扩容缩容配置案例详解
事务数据库及其四特性,原理,隔离级别,脏读,幻读,不可重复读?
Connect mysql detailed graphic operations in ECs docker (all)
7.13 蔚来提前批笔试









