标签:writable 并且 ISE 字符串 memory 声明 efi after 一个
str.padStart(targetLength [, padString])
str.padEnd(targetLength [, padString])
"es8".padStart(2); // ‘es8‘
"es8".padStart(5); // ‘ es8‘
"es8".padStart(6, "woof"); // ‘wooes8‘
"es8".padStart(14, "wow"); // ‘wowwowwowwoes8‘
"es8".padStart(7, "0"); // ‘0000es8‘
"es8".padEnd(2); // ‘es8‘
"es8".padEnd(5); // ‘es8 ‘
"es8".padEnd(6, "woof"); // ‘es8woo‘
"es8".padEnd(14, "wow"); // ‘es8wowwowwowwo‘
"es8".padEnd(7, "6"); // ‘es86666‘
Object.values(obj);
const obj = { x: "xxx", y: 1 };
Object.values(obj); // [‘xxx‘, 1]
const obj = ["e", "s", "8"]; // same as { 0: ‘e‘, 1: ‘s‘, 2: ‘8‘ };
Object.values(obj); // [‘e‘, ‘s‘, ‘8‘]
// 当使用数字作为key时,返回的值的顺序是和key的大小顺序一致的
const obj = { 10: "xxx", 1: "yyy", 3: "zzz" };
Object.values(obj); // [‘yyy‘, ‘zzz‘, ‘xxx‘]
Object.values("es8"); // [‘e‘, ‘s‘, ‘8‘]
const obj = { x: "xxx", y: 1 };
Object.entries(obj); // [[‘x‘, ‘xxx‘], [‘y‘, 1]]
const obj = ["e", "s", "8"];
Object.entries(obj); // [[‘0‘, ‘e‘], [‘1‘, ‘s‘], [‘2‘, ‘8‘]]
const obj = { 10: "xxx", 1: "yyy", 3: "zzz" };
Object.entries(obj); // [[‘1‘, ‘yyy‘], [‘3‘, ‘zzz‘], [‘10‘: ‘xxx‘]]
Object.entries("es8"); // [[‘0‘, ‘e‘], [‘1‘, ‘s‘], [‘2‘, ‘8‘]]
Object.getOwnPropertyDescriptor(obj, prop);
Object.getOwnPropertyDescriptors(obj);
const obj = {
get es8() {
return 888;
},
};
Object.getOwnPropertyDescriptor(obj, "es8");
// {
// configurable: true,
// enumerable: true,
// get: function es8(){}, //the getter function
// set: undefined
// }
const objj = {
a: 1,
b: "2",
c: true,
d: null,
e: undefined,
f: {},
};
Object.getOwnPropertyDescriptors(objj);
// {
// a: {value: 1, writable: true, enumerable: true, configurable: true},
// b: {value: "2", writable: true, enumerable: true, configurable: true},
// c: {value: true, writable: true, enumerable: true, configurable: true},
// d: {value: null, writable: true, enumerable: true, configurable: true},
// e: {value: undefined, writable: true, enumerable: true, configurable: true},
// f: {value: {}, writable: true, enumerable: true, configurable: true},
// }
function es8(var1, var2, var3) {
// do something
//函数内部的 arguments.length 是 3 还是 4 ?
console.log(arguments.length); // 3
}
es8(10, 20, 30);
function resolveAfter2Seconds() {
return new Promise((resolve) => {
setTimeout(() => {
resolve("resolved");
}, 2000);
});
}
async function asyncCall() {
console.log("calling");
const result = await resolveAfter2Seconds();
console.log(result);
}
asyncCall();
// calling
// resolved
标签:writable 并且 ISE 字符串 memory 声明 efi after 一个
原文地址:https://www.cnblogs.com/frank-link/p/14757966.html