Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

ES6 模块导出,下面两种方式有什么区别?

第一种:

export const A_STRING = 'Hello'
export const A_FUNC = (str) => str.toUpperCase() 

第二种

const A_STRING = 'Hello'
const A_FUNC = (str) => str.toUpperCase() 
export {
    A_STRING,
    A_FUNC
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
308 views
Welcome To Ask or Share your Answers For Others

1 Answer

没区别,就是写法的不同。前者方便些罢了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...