当前位置: 首页 > wzjs >正文

品牌网站建设框架wordpress 音乐插件

品牌网站建设框架,wordpress 音乐插件,个人网页制作成品源代码,中国互联网排名前十名目录 1. 数据类型概述 2. Undefined类型 3. Null类型 4. Boolean类型 构造函数 实例方法 5. Number类型 构造函数 静态属性 实例方法 6. String类型 构造函数 实例方法 7. Symbol类型 构造函数 静态方法 8. BigInt类型 构造函数 实例方法 9. Object类型 构…

目录

1. 数据类型概述

2. Undefined类型

3. Null类型

4. Boolean类型

构造函数

实例方法

5. Number类型

构造函数

静态属性

实例方法

6. String类型

构造函数

实例方法

7. Symbol类型

构造函数

静态方法

8. BigInt类型

构造函数

实例方法

9. Object类型

构造函数

静态方法

原型方法

常见子类型示例

Array类型

Date类型



1. 数据类型概述

JavaScript共有8种数据类型:

  • 基本类型(7种):Undefined、Null、Boolean、Number、String、Symbol、BigInt
  • 复杂类型(1种):Object

2. Undefined类型

表示未定义的值,没有构造函数和内置方法

let test;
console.log(test); // undefined


3. Null类型

表示空值,没有构造函数和内置方法

let empty = null;
console.log(empty); // null


4. Boolean类型

构造函数
new Boolean(value) // 返回布尔对象
Boolean(value)     // 返回原始值

实例方法
const bool = new Boolean(true);// toString()
console.log(bool.toString()); // "true"// valueOf()
console.log(bool.valueOf());  // true


5. Number类型

构造函数
new Number(value) // 返回数字对象
Number(value)     // 返回原始值

静态属性
Number.MAX_VALUE    // 最大数值
Number.MIN_VALUE    // 最小正值
Number.NaN          // 非数字值

实例方法
const num = 123.456;// toFixed(n)
console.log(num.toFixed(2)); // "123.46"// toString(radix)
console.log(num.toString(16)); // "7b.74bc6a7ef9"// toExponential(n)
console.log(num.toExponential(2)); // "1.23e+2"


6. String类型

构造函数
new String(text) // 返回字符串对象
String(text)     // 返回原始值

实例方法
const str = "Hello World";// charAt(index)
console.log(str.charAt(1)); // "e"// substring(start, end)
console.log(str.substring(0,5)); // "Hello"// replace(search, replace)
console.log(str.replace("World", "JS")); // "Hello JS"


7. Symbol类型

构造函数
Symbol([description])

静态方法
// Symbol.for(key)
const sym1 = Symbol.for('uid');// Symbol.keyFor(sym)
console.log(Symbol.keyFor(sym1)); // "uid"


8. BigInt类型

构造函数
BigInt(value)

实例方法
const bigInt = 123n;// toString()
console.log(bigInt.toString()); // "123"// valueOf()
console.log(bigInt.valueOf());  // 123n


9. Object类型

构造函数
new Object()

静态方法
// Object.keys(obj)
const obj = {a:1, b:2};
console.log(Object.keys(obj)); // ["a", "b"]// Object.assign(target, source)
const target = {a:1};
Object.assign(target, {b:2});
console.log(target); // {a:1, b:2}

原型方法
// hasOwnProperty(key)
console.log(obj.hasOwnProperty('a')); // true// toString()
console.log(obj.toString()); // "[object Object]"


常见子类型示例

Array类型
const arr = [1,2,3];// push(element)
arr.push(4); // [1,2,3,4]// map(callback)
console.log(arr.map(x => x*2)); // [2,4,6,8]

Date类型
const date = new Date();// getFullYear()
console.log(date.getFullYear()); // 当前年份// toISOString()
console.log(date.toISOString()); // ISO格式字符串


本文完整覆盖了JavaScript的8种数据类型及其核心内置方法,通过示例代码演示了各类型的主要特性。实际开发中建议优先使用原始类型,仅在必要时使用包装对象。

http://www.dtcms.com/wzjs/788000.html

相关文章:

  • 郑州做网站比较好的公司义乌网页制作
  • 网页设计ai湘潭seo公司
  • 承德建设局网站discuz手机模板
  • 网站怎么做七牛云加速网络推广外包加手机蛙软件
  • 深圳南山 网站建设ps素材网站大全
  • 网站备案 免费导航网站制作 zhihu
  • 网站的建站公司建立本机网站
  • 如何创办一个网站网站你啦怎样做旺仔饼干
  • 国外建筑设计网站上海低价网站建设
  • 北京网站建设 义创怎么建设银行网站打不开
  • 牙科医院网站设计怎么做wordpress页面加载慢
  • 做平面设计必看的网站公司单位电话号码大全
  • 网站建设需要的客户资料哈尔滨市建设工程招标网
  • 学院网站建设情况广州外贸型网站
  • 移动端网站模板哈尔滨干肠制作
  • 淄博网站设计公司北京建站程序
  • 精品成品网站入口企业营销型网站有特点
  • 王者做网站百度推广计划
  • 做网站用的图标星巴克已有的网络营销方式
  • 深圳建设网站公司排名网站开发的岗位
  • 外国茶网站建设wordpress男同
  • 800元建网站网站商城html模板
  • 做网站运营需要具备哪些能力网站建设费用是什么科目
  • 蛇口网站建设Wordpress 普通图片裁剪
  • 如何利用div做网站南昌做网站排名
  • 东莞免费做网站公司邢台做移动网站公司电话
  • 黑icp 网站建设河北省企业网站建设公司
  • google移动网站建站十大原则安徽工程建设信息网站6
  • 做搜狗网站优wordpress 动态文字
  • 雄安免费网站建设电话网站开发用什么框架好