- 1. emoj表情的长度
 - 2. NaN
 - 3. 数组的最大长度
 - 4. Reflect.ownKeys() 扩展运算符会把数组空的位置的值变为undefined
 - 5. catch块捕获到的变量是私有的
 - Why in JavaScript both “Object instanceof Function” and “Function instanceof Object” return true?">6. Why in JavaScript both “Object instanceof Function” and “Function instanceof Object” return true?
 - 7. Function和Object互相instanceof都为true
 - 8. 函数参数引用
 - 9. String.raw
 - 10. +”b”的结果?
 - 11. 私有类成员
 - 12. proxy
 - 13. css水平垂直居中
 - 14. CSS三行省略号
 - 15. grid实现两栏布局
 - 16. CSS获取选中状态的checkbox
 
1. emoj表情的长度
length方法是返回的是unit的个数,普通字符一个unit
字符串使用的是utf-16
console.log('👍'.length)
2. NaN
Object.is(NaN,NaN) // true[NaN].includes(NaN) // true 使用的是零值相等比较算法[NaN].indexOf(NaN) // false 使用严格相等比较算法Math.max(NaN , 1) // NaN 有一个操作数是NaN就返回NaN
3. 数组的最大长度
https://bigfrontend.dev/quiz/largest-Array-index/discuss
JavaScript arrays are zero-based and use 32-bit indexes
从0开始4个字节长度的索引: 0 ~ 2  32 - 2**
4. Reflect.ownKeys() 扩展运算符会把数组空的位置的值变为undefined
The static Reflect.ownKeys() method returns an array of the target object’s own property keys.
https://bigfrontend.dev/quiz/array-keys/discuss
5. catch块捕获到的变量是私有的
https://bigfrontend.dev/quiz/try-catch/discuss
var a = 'a'try {throw new Error('BFE.dev')} catch {var a = 'a1'}console.log(a)var b = 'b'try {throw new Error('BFE.dev')} catch (b) {var b = 'b1'}console.log(b)var c = 'c'try {throw new Error('BFE.dev')} catch (error) {var c = 'c1'}console.log(c)//结果"a1""b""c1"
6. Why in JavaScript both “Object instanceof Function” and “Function instanceof Object” return true?
7. Function和Object互相instanceof都为true
// 全部都为trueconsole.log(Function instanceof Object)console.log(Object instanceof Function)console.log(Function instanceof Function)console.log(Object instanceof Object)
8. 函数参数引用
let func = () => {console.log(1)}setTimeout(func, 100) // 1func = 1
9. String.raw
https://bigfrontend.dev/quiz/String-raw/discuss
第一个参数是一个带raw属性的对象,值是字符串或数组,raw将之后的参数分隔,多余参数被忽略
// using arrayString.raw({ raw: [0,2,4] }, 1, 3, 5, 6, 7) // "01234"// using stringString.raw({ raw: '024' }, 1, 3, 5, 6, 7) // "01234"console.log("BFE\ndev") // \n gets escaped// BFE// devconsole.log(`BFE\ndev`) // \n gets escaped// BFE// devconsole.log(String.raw`BFE\ndev`) // \n remains as it is// BFE\ndev
10. +”b”的结果?
是 NaN而不是98
11. 私有类成员
https://bigfrontend.dev/quiz/Proxy-II/discuss
添加一个#前缀
proxy代理不能访问私有成员
12. proxy
https://bigfrontend.dev/quiz/proxy-i/discuss
如果为定义handler则将操作转发到代理的target,但是这些操作仅限于属性访问等基本行为,像Map和Set自身行为如set,add等将会抛出错误
13. css水平垂直居中
grid
display: grid;place-items: center;
14. CSS三行省略号
.max-three-lines {/* your code here */display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;overflow: hidden;}
15. grid实现两栏布局
左边最小100px, 宽度为25%, 右边自适应
grid-template-columns: minmax(100px, 25%) auto;
16. CSS获取选中状态的checkbox
input[type="checkbox"]:checked
