Answers for "var javascript"

3

how to write a variable in js

//choose the best for your solution
var myVariable = 22; //this can be a string or number. var is globally defined

let myVariable = 22; //this can be a string or number. let is block scoped

const myVariable = 22; //this can be a string or number. const is block scoped and
Posted by: Guest on June-03-2020
6

js variable

var Number = 5;
var String = "Hi!";
var boolen1 = true;
var boolen2 = false;
var array = [11, "Hi!", true];
var object = {age:11, speach:"Hi!", likes_Bananas:true};
Posted by: Guest on June-21-2020
4

js variables

//Making variables with let:
let numberOfFriends = 1;

//Incrementing:
numberOfFriends += 3; //numberOfFriends is now 4

// Variables with const
const minimumAge = 21; //CANNOT REASSIGN!

//Booleans - true or false values
true;
false;
let isHappy = true;

//Naming Conventions
// Use upper camel-cased names:
let numberOfChickens = 6; //GOOD
// NOT THE JS WAY:
// let number_of_chickens = 6;
Posted by: Guest on January-04-2021
6

var javascript

var user_name = prompt("Please enter your name:", "Type here");
alert("Hello " + user_name);
Posted by: Guest on November-03-2020
1

var javascript

var text = "";
var i;
for (i = 0; i < 5; i++) {
  text += "The number is " + i + "<br>";
}
Posted by: Guest on April-05-2021
1

var javascript

var is a keyword to define the varible in js but as of es-6 we, use let and const keywords for the same
Posted by: Guest on December-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language