Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
var data = "hi"; //string - just holds text characters
var number = 3; // sumber
var bool = true; // boolean
var object = {"firstname":"joe","lastname":"smith", "enrolled":true,"age":25}; //this is sometimes reffered to as jasom - key value pairs all seperated by commas
//think of this as a way to hold or store data
var array = [2,3,4,5,6];
//arrays do not have key value pairs, they hold values, could be any kind of data like a boolian or whatever
data = 10 - number; //not a good practice to do this - to change the data twice
//the name does not matter bc the type is based on the data you assign to it
//operators - = assigns values
data = 10 - number; //10-3
data++; //10+1
data--; //10-1
var hello = "Hello";
hello = hello + "there";
hello = hello + 6;
console.log(hello);
console.log(data);
if(number >= 2) {
console.log("it is true");}
else if(number <=1)
{console.log("Something else is true")}
else{
console.log("Everything else is false")
}
switch(data){
case 1:
console.log("number is 1");
break;
case 2:
console.log("number is 2");
break;
default:
console.log("number is a number");
break;
}
//each case is saying "if data =#, then run that case"
function logData(text) { //calling a function with a parameter
console.log(text)
}
logData();
//the parenthases take in data and the curly brackets are what is contained in the function
//parameters are only used within the function