动手做Get your hands on it
练习跟着课文走 —— 每节课尾都有本课的练习。这一页是全部练习的总库,想集中刷题的时候来。 每个练习都写清了它来自哪一节,卡住了就回去看那一节。Practice follows the lessons — every lesson ends with the exercises for that lesson. This page is the whole library, for when you want to drill in one sitting. Each exercise names the lesson it came from, so you can go back when you stall.
已筛到你正在学的《面试八股》。想看全部就点上面的「全部」。Filtered to Interview questions — the course you are on. Use “All” above to see everything.
练习Exercises
筛出 16 个练习(共 148 个) · 第 2 / 2 页。Showing 16 of 148 · page 2 / 2.- on 注册;emit 按注册顺序调用所有监听器并传参on registers a listener; emit calls every listener in registration order and passes the arguments along
- off 只移除指定的那一个监听器off removes only the one listener it was given
- once 只触发一次,且不挤掉同一事件的其他监听器once fires exactly once, and does not push aside the other listeners on the same event
- emit 返回「有没有人在听」emit returns whether anyone was listening
看答案之前,先确认你已经自己动手写过一遍。看懂别人的答案和自己写出来,是两种能力。Before you open this, make sure you have written it yourself once. Following someone else's answer and producing your own are two different skills.
- get / put 基本读写;get 不到返回 undefinedBasic reads and writes through get and put; a miss on get returns undefined
- 超容量时淘汰最久未使用的那条Over capacity, drop the entry that has gone unused the longest
- get 命中要刷新「最近用过」A hit on get marks that entry as recently used
- put 已存在的 key:更新值并刷新put on a key that already exists updates the value and marks it as recently used
- capacity 为 1 也要正确A capacity of 1 still behaves correctly
看答案之前,先确认你已经自己动手写过一遍。看懂别人的答案和自己写出来,是两种能力。Before you open this, make sure you have written it yourself once. Following someone else's answer and producing your own are two different skills.
面试官给出下面这个类型,问它对 T 做了什么。
An interviewer shows you the type below and asks what it does to T.
这个函数编译不过:'e' is of type 'unknown'.下面哪种改法是对的?
This function does not compile: 'e' is of type 'unknown'. Which fix is the right one?