redeclare var javascript code example Example: Redeclaring variable in the javascript var x = 2; // Now x is 2 var x = 3; // Now x is 3