# 章序号/节序号/节/笔记序号
codecademy, Introduction
# 概念阐释
属于[[JavaScript 内置对象]]中的一组,构建交互式页面的常用工具之一,也叫做全局JavaScript对象。不构成模型,独立的对象,与JavaScript语言的不同部分相关。标准内置对象的名字通常大写。
## 标准内置对象分类
- 属性值
- 函数属性
- 基本对象
- Object
- Function
- Boolean
- Symbol
- 错误对象
- 数字和日期对象
- Number
- BigInt
- Math
- Date
- 字符串
- String
- RegExp
- 可索引的集合对象
- Array
- 使用健的集合对象
- 结构化数据
- [[JSON]]
- 控制抽象对象
- 反射
- 国际化
- WebAssembly
- 其他
# 举例子
计算更加复杂的数学运算可以使用`math`对象
- 取0~1之间的随机数字
```js
console.log(Math.random()); // Prints a random number between 0 and 1
```
- 取0~49之间的随机整数
```js
console.log(Math.floor(Math.random() * 50)); // Prints a random whole number between 0 and 50
```
- 取0~7之间的整数,`*8`
- 取0~10之间的整数,`*11`
字符串内置对象
```js
console.log('hello'.toUpperCase()); // Prints HELLO
```
# 类比、比较与对比
# 问题
**1.** 完成以下步骤
1. Inside of a `console.log()`, create a random number with `Math.random()`, then multiply it by `100`.
2. Now, use `Math.floor()` to make the output a whole number.Inside the `console.log()` you wrote in the last step, put the existing `Math.random() * 100` code inside the parentheses of `Math.floor()`.
3. Find a method on the [JavaScript `Math` object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math) that returns the smallest integer greater than or equal to a decimal number.Use this method with the number `43.8`. Log the answer to the console.*就是小数点后面约等于,<.5向小数值约等于,>.5向大数值约等于。*
1. Use the [JavaScript documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) to find a method on the built-in Number object that checks if a number is an `integer`.Put the number `2017` in the parentheses of the method and use `console.log()` to print the result.
**2.** `startsWith`和`trim` 的用途?查询语法,并写出例子。
# 问题答案
```js
console.log(Math.random() *100 );
console.log(Math.floor(Math.random() *100 ));
console.log(Math.ceil(43.8));
console.log(Number.isInteger(2017));
```
```js
console.log('Hey'.startsWith(H));//直接写string
let myName = 'Harry'; //用引入函数的写法
console.log(myName.startsWith('h'));
console.log(' remove whitespace '.trim()); prints remove shtiespace 前后没有空格
```
# 备注(经验集/错误集)
## 经验集
- console只是一个让计算机print出内容的对象
- console里面的内容可以是任何数据类型、方法、属性、变量名
- 这些方法属性也没有特别固定的写法,可以各种嵌套,并与逻辑运算符、比较运算符搭配使用
## 参考资料
- [[Built-in objects standard 标准内置对象| 大纲笔记]]
- [codecademy 课程页面](https://www.codecademy.com/courses/introduction-to-javascript/lessons/introduction-to-javascript/exercises/libraries)
- [Standard built-in objects MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects)