且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单个逗号分隔的变量声明和多个声明之间有什么区别?

更新时间:2023-10-23 08:49:22

以逗号分隔的声明只是简写.执行方面没有区别.但是,如果您声明了很多变量,它可以帮助减小javascript文件的大小.

The comma separated declaration is just a short hand. Executing-wise there's no difference. But it can help reduce the size of your javascript file if you are declaring a lot of variables.

您甚至可以:

var a = 1, b = 'string', c = new Date();