Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test11 #1

Open
zhl1232 opened this issue Apr 1, 2019 · 0 comments
Open

test11 #1

zhl1232 opened this issue Apr 1, 2019 · 0 comments

Comments

@zhl1232
Copy link
Owner

zhl1232 commented Apr 1, 2019

caller
这个属性中保存着调用当前函数的函数的引用,如果是在全局作用域中调用当前函数,它的值为null

function的length属性表示function的形参个数

每个函数都包含两个非继承而来的方法:call(),apply()

Object构造函数会像工厂方法一样,根据传入的值的类型返回相应基本包装类型的实例

let a = new Object(123)
let b = new Object('123')

console.log(Object.prototype.toString.call(a)); // [object Number]
console.log(Object.prototype.toString.call(b)); // [object String]

Number

number的toString方法传递一个表示基数的参数,告诉它返回几进制的字符串

let num = 10
num.toString()  // "10"
num.toString(2)  // "1010"
num.toString(8)  // "12"
num.toString(10)  // "10"
num.toString(16)  // "a"

toFixed()按指定小数位返回数值的字符串,少于小数位会补0,多于小数位会舍入

toExponential()返回科学计数法,指数方式

toPrecision()会返回一个数值的最合适的格式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant