基于初始化 Javascript 对象的两种方式,哪一种更好,哪种更快?
// first
options = {
prop1: 1,
prop2: 2
}
//second
Secoptions = {};
Secoptions.prop1 = 1;
Secoptions.prop2 = 2;
(function($) {
$(document).ready(function() {
//based on the two ways of initializing a javascript object
//which one is the better one and faster
// first
options = {
prop1: 1,
prop2: 2
}
//second
Secoptions = {};
Secoptions.prop1 = 1;
Secoptions.prop2 = 2;
});
})(jQuery);