+ 4

How to add variables in js?

For example, var g=20; var e=27; then how to add them?

22nd May 2018, 7:39 AM
keev23i
keev23i - avatar
2 Answers
+ 5
One example: var sum = g + e; The result will be stored in the variable sum
22nd May 2018, 7:47 AM
Stefano Prosperi
Stefano Prosperi - avatar
+ 3
var g = 20; var e = 27; var add = g + e; document.write(add)
23rd May 2018, 2:37 AM
Rahul Hemdev
Rahul Hemdev - avatar