Answers for "what is a var in javascript"

2

js variables

// JS Variables
var varExample = "var"; // var is use for variable in js the problem with it that it has complicated scope 
let letExample = "let"; // let is pretty much same as var the only thing which make its more varriable is its variable scope.
const constExample = "const"; // const is use for constant values and this variable scope is sane as let
Posted by: Guest on April-25-2021
1

variables in js

Variables can have anything, you define them as equal to something
    
    eg:   var x = 22
    var statement = 'hello!'
    var isAbool = true 
    
    there are three types of variables:
1. var 
2. let
3. const 

var is a normal variable
let is a variable whose value can be changed eg: let h = 12, h = 10(we changed the value, if you run this, there will be no error)
const is a variable whose value cannot be changed, if you change the value of a const, you will have errors in you code
Posted by: Guest on October-29-2020
0

how to make a variable equal a specific element in javascript

//How to make a variable equal a specific element in javascript.

/*====DESCRIPTION STARTS HERE=======
Assuming you've already created an array and a variable, you simply set the
variable equal to the array, specifying the specific location of the value
it holds. Note though that when specifying the location, subtract one
number from the actual number we percieve. The reason for this is that computers
begin counting at 0.
  =====DESCRIPTION ENDS HERE========*/

//=====EXAMPLE=========
var listOfFirstNames = ["Will", "Kotori", "Grace", "James"]
var FirstName = listOfFirstNames[2] /*firstName now has the value of "Grace"
									since grace is the 2nd (or 3rd) element
									of the array*/
Posted by: Guest on October-21-2020
-1

vars javascript

var /*var*/ = /*What it does*/
Posted by: Guest on September-22-2020

Code answers related to "what is a var in javascript"

Browse Popular Code Answers by Language