為什麼自己寫的 JavaScript 模組不能直接在 import 解構賦值 (Destructuring Assignment)

我們寫 ES6 的 JavaScript 常會使用到模組化語法 (import / export default),讓我們來詳細解釋 export default 與 export 的差異吧!

Ryan Hsu
Ryan Hsu
Aug 31, 2018 · 5 min read
“aligned black and gray metal equipment part high-angle photo” by Florian Klauer on Unsplash

什麼是解構賦值 ?

這是一種 JavaScript 的 ES6 規範,我們可以達成「同時宣告同時取值」,來減少我們需要寫的程式與解決屬性鏈問題 (property chain)。

Keep the story going. Sign up for an extra free read.

You've completed your member preview for this month, but when you sign up for a free Medium account, you get one more story.
Already have an account? Sign in

Ryan Hsu

Written by

Ryan Hsu

Front-end developer

Its Ok to Make Mistakes

分享UI UX 設計、前端開發、數位行銷所遇到的雷點 。It’s not how we make mistakes, but how we correct them that defines us.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade