TagJavaScript

JavaScript 可愛筆記 #0 – 兩個等於真的有那麼壞嗎?

JS_Cute_0

在 JS 裡比較是否相等時,到底要用兩個等於 == 還是三個等於 === 呢?===== 到底差在哪?為什麼大家總是說盡量不要用 == 呢?

最近剛好被學弟問到相關的問題,雖然知道 == 背後再做什麼,但又覺得 JS spec 上寫得好長好難記,也就勸了學弟不用真的去記。但看完 Kyle Simpson 的解釋後,就默默記起來了。所以只能怪罪自己懶,因此寫下這個筆記。

Kyle Simpson 是著名的 You Don’t Know JS (YDKJS) 的作者。我感受到他費了不少力氣淬煉出讓大家都好消化的解釋。

Kyle 甚至提出應該多多使用 ==,然後用 === 來警告讀這段 code 的人說,「你要注意這裡,因為我搞不清楚等號兩邊的型別(type)是什麼」。

(more…)

Installing vue-cli with Yarn

FYI, I’m only starting out too, this post just delivers the topic “Installing vue-cli with Yarn”, and it’s not working out of the box as of 2016-11-02. See issue. It will be fixed very soon.

No comparisons, no introductions, and other bullshit involved.

Just checking out vue.js and saw that it provides a cli tool to scaffold projects, Just wondering, why not just use yo generator? And I found this issue, saying

The main reason is that vue-cli makes it easier to just fork one of the official templates and create your own tailored template. […]

The other factor is branding. vue init just feels better than yo vue 😉

So for the sake of feeling better… I guess?

(more…)

Reader Favorites

Recent Posts

Categories