What is the difference between let and var in a multiple variable definition?

I’m getting a Syntax Error in my firefox console:

let admin,
names = "Bob",
admin = names;

alert(admin);

Using the var variable is not recommended, but could such a definition cause an error?
No error:

var admin,
names = "Bob",
admin = names;

alert(admin);

Different syntax of the let variable (No error):

let admin, names;

names = "Bob";

admin = names;

alert(admin);

I’ve explored the difference between the var and let variable, but I don’t fully understand the differences here.

What are the differences between the codes?

55 thoughts on “What is the difference between let and var in a multiple variable definition?”