Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设您需要一个硬编码的字符串列表(这里的问题不是您是否应该对事物进行硬编码)。
有没有理由更喜欢这个:
var things = 'a b see'.split(' ');
对此:
var things = ['a', 'b', 'see'];
第一种方法的优点:
第二种方法的优点: