OneBite.Dev - Coding blog in a bite size

assign multiple variables in Javascript

Code snippet on how to assign multiple variables in Javascript

  var name = "John", age = 25, job = "programmer";

This code assigns three variables: name, age, and job. The variable “name” is assigned the value “John”, the variable “age” is assigned the value 25, and the variable “job” is assigned the value “programmer”. This code uses the keyword “var” to declare each variable and assign them the given value with the “=” operator. The code also uses a single line to declare multiple variables and assign all of the required values.

javascript