From a125bfd07fe9358ec102f6983f8d2beab8eab2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E7=AC=91=E5=AE=B9?= Date: Sun, 29 Oct 2023 21:07:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B9=AB=E5=AE=9D=E7=9A=84js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\346\215\256\347\261\273\345\236\213.md" | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 "10 \347\253\240\347\254\221\345\256\271/Day1027 \345\217\230\351\207\217\344\270\216\346\225\260\346\215\256\347\261\273\345\236\213.md" diff --git "a/10 \347\253\240\347\254\221\345\256\271/Day1027 \345\217\230\351\207\217\344\270\216\346\225\260\346\215\256\347\261\273\345\236\213.md" "b/10 \347\253\240\347\254\221\345\256\271/Day1027 \345\217\230\351\207\217\344\270\216\346\225\260\346\215\256\347\261\273\345\236\213.md" new file mode 100644 index 0000000..430c2e5 --- /dev/null +++ "b/10 \347\253\240\347\254\221\345\256\271/Day1027 \345\217\230\351\207\217\344\270\216\346\225\260\346\215\256\347\261\273\345\236\213.md" @@ -0,0 +1,145 @@ +# 今日份日志 + +1. 变量 + + ```js + 用let定义变量,用const定义常量 + let myName = 'mockQ湫'; + let age = 19; + let height = 165; + let weight = 50; + let hobby = '动漫,cosplay,音乐'; + console.log(`这里是${myName},${age}岁,海拔${height},质量${weight}`); + + + let bhby = document.querySelector('button'); + // console.log(bhby); + bhby.onclick = function () { + alert(hobby); + } + + let name = 'coderwhy'; + let admin = name; + console.log(name); + console.log(admin); + + // 方式一 + let a = 10; + let b = 20; + + let c = a; + a = b; + b = c; + console.log('a=' + a); + console.log('b=' + b); + console.log('c=' + c); + + // 方式二 + let a1 = 10; + let b1 = 20; + a1 = a1 + b1; + b1 = a1 - b1; + a1 = a1 - b1; + console.log('a1:' + a1); + console.log('b1:' + b1); + ``` + + + +2. 数据类型 + + ```js + // Number:数值类型,包含所有浮点数,整数 + console.log(Number.MIN_VALUE); // 最小数 + console.log(Number.MAX_VALUE); // 最大数 + // infinity:代表数字中的无穷大 + console.log(1 / 0);// = infinity + console.log(-1 / 0); // = -infinity 负无穷大 + // NaN Not a Number 不是一个数字 + console.log('aa' / 1); + // isNaN 当为数字时,返回FALSE 不为数字时,返回TRUE + console.log(isNaN('a')); // true + console.log(isNaN(2)); // false + + + // String:字符串类型,用'',"",``都一样,没有区别 + // 定义String类型时,引号必须成双成对 + // 转义符: + // \' 表示这就是一个单引号* + // \" 表示这就是一个双引号* + // \\ 反斜杠 + // \n 换行符 + // \r 回车符 + // \t 制表符* + // \b 退格符 * + // 获取字符串长度 + let str = 'qiuqiuqiu湫'; + console.log(str.length); + // Boolean:布尔型,两个值true,false + // Unidefined:表示未赋值的变量,与null不同,null,是连定义都没有,既是数据类型,也是值 + // Object:引用类型或复杂类型,指向一个地址,往往包含一组数据,用{}表示一个对象 + // Null:什么都没有,既是数据类型,又是值 + ``` + + # 练习 + + ```js + + + + + + + Document + + + + + + + + ``` + + \ No newline at end of file -- Gitee