Adding JavaScript variables more efficiently?

If i have two sum variables with total individual variables. Is there an easier way of getting the sum? Example: var first_one = 5; var first_two = 5; var second_one = 5; var second_two = 5; var firstTotal = first_one + first_two; var secondTotal = second_one + second_two; var total = firstTotal + secondTotal; return total;
How is that more efficient? It takes longer to type, more bytes to store, and the only way to implement it involves using a function call instead of a simple operator!

以上就是Adding JavaScript variables more efficiently?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准