38 lines
730 B
HTML
38 lines
730 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>JS-数据类型</title>
|
|
</head>
|
|
<body>
|
|
|
|
|
|
<script>
|
|
//1. 数据类型
|
|
// alert(typeof 10);
|
|
// alert(typeof 1.5);
|
|
|
|
// alert(typeof true);
|
|
// alert(typeof false);
|
|
|
|
// alert(typeof "Hello");
|
|
// alert(typeof 'JS');
|
|
// alert(typeof `JavaScript`);
|
|
|
|
// alert(typeof null);
|
|
|
|
// let a ;
|
|
// alert(typeof a);
|
|
|
|
// 2.模板字符串
|
|
let name = `小王`;
|
|
let age = 18;
|
|
|
|
console.log(`我是${name},我今年${age}岁`);
|
|
console.log('我是' + name + ',我今年' + age + '岁');
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html> |