[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
前言
在前端开发过程中,有三驾马车组成:JS、CSS、HTML,JS负责页面交互,CSS负责页面样式,HTML负责页面结构,这三大块也是在实际开发中必备内容,关于三者所起到的作用不用说读者就知道。本文想要分享的是关于JS相关的内容,尤其是在实际开发中比较常用且重要的知识点,总结分享一下,方便后期查阅使用。
JS特点
说到JS的特点,大家都知道,但是要让把JS特点全部说出来又有点说不完整,那么这里就来先看看JS的特点有哪些吧。
* 脚本语言,依赖于html/jsp/asp页面,可以在浏览器中运行;
* JS是一种轻量级、面向对象、跨平台的客户端脚本语言;
* 属于解释性语言,不需要编译;
* 在程序中,对象是由“属性”和“方法”构成;
* JS是单线程,事件驱动的方式进行;
* JS是嵌入到浏览器软件中的,只要电脑端安装有浏览器就可以运行JS程序。
JS的语法
JS的引入方式分为内部和外部两种引入方式。
* 内部引入:直接写在html/jsp页面中,可写在head内,也可写在body中;
* 外部引入:把JS代码单独写在JS文件中,在html/jsp的head(body)中引入JS文件。
JS的变量
1、变量的概念
变量可以看作是一个“未知数”,也可看作是一个“符号” “标识”。变量指的程序当中的数据,运行在内存当中的,它是临时存在的数据