Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saddam Add remaining codes #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 58 additions & 24 deletions practice.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@

//Create a variable called myName that is a string data type

//Code here
var myName = "Saddam";

//////////////////PROBLEM 2////////////////////

//Create a variable called myAge that is a number data type

//Code here
var myAge=20;

//////////////////PROBLEM 3////////////////////

//Create a variable called lovesCode that is a boolean data type

//Code here
var lovesCode=true;

//////////////////PROBLEM 4////////////////////

//Create a variable called greatestFear that is undefined because we fear nothing

//Code here

var greatestFear;
//////////////////PROBLEM 5////////////////////

//Create a variable called devMountainGoal that is null because we are just starting out

//Code here
var devMountainGoal=null;

//////////////////PROBLEM 6////////////////////

Expand All @@ -35,21 +34,27 @@
//greeting should return the string "Hello, "
//plus the value of the name parameter.

//Code here
function greeting(name){
return "Hello, "+name;
}

//////////////////PROBLEM 7////////////////////

//Write a function expression called newGreeting.
//Give it the same functionality as the function greeting in Problem 6.

//Code Here
var newGreeting=function (name){
return "Hello, "+name;
}
newGreeting();

//////////////////PROBLEM 8////////////////////

//Create an array called groceries with the values
//"apples", "milk", "eggs", "bread"

//Code Here
var groceries=["apples", "milk", "eggs", "bread"];


//////////////////PROBLEM 9////////////////////

Expand All @@ -58,12 +63,17 @@
//name (a string), color (a string), age (a number),
//and goodBoy (a boolean).

//Code Here
var dog={
name:'sammy',
color:'black',
age:4,
goodBoy:true,
};

//...access the dog's name from the object and assign it to a
//variable called devMountainClassPet.

//Code Here
var devMountainClassPet=dog.name;

//////////////////PROBLEM 10////////////////////

Expand All @@ -74,20 +84,33 @@
// If the name parameter is anything else, return 'Cool name, NAMEPARAM'
// with NAMEPARAM being the name parameter being passed in (not literally NAMEPARAM)

// Code here
function nameCheck(name){
if(name=="Steven"){
return "What is up Steven?";
}
else if (name=="Bryan")
{
return "Hey Bryan!";
} else {
return "Cool name, "+name;
}
}

//////////////////PROBLEM 11////////////////////

// Create a function called add that takes in two parameters
// that will be numbers.
// The add function should return the two parameters added together

//Code Here
function add(n1,n2){
return n1+n2;
}

//Now invoke add, passing in the numbers 3 and 4
//storing the result in the variable mathSum.

//Code Here
mathSum=add(3,4);


//////////////////PROBLEM 12////////////////////

Expand All @@ -98,7 +121,20 @@
// If the passed in color equals 'black', return 'so trendy'
// Otherwise, you should return the string 'you need to evaluate your favorite color choice'

// Code here
function faveColorFinder(color){
if(color=="red"){
return 'red is a great color';
}
else if(color=="green"){
return 'green is a solid favorite color';
}
else if(color=="black"){
return'so trendy';
}
else{
return 'you need to evaluate your favorite color choice';
}
}

//////////////////PROBLEM 13////////////////////

Expand All @@ -122,28 +158,26 @@ function pond() {
//as strings.

//This array should contain the variable names (as strings) accessible in the global scope.
let globalScope = ["duck", "sailorDuck", "rubberDuck", "realDuck"];
let globalScope = ["duck"];

//This array should contain the variable names (as strings) accessible in the bathroom function.
let bathroomScope = ["duck", "sailorDuck", "rubberDuck", "realDuck"];
var bathroomScope = ["duck","rubberDuck"];

//This array should contain the variable names (as strings) accessible in the bathtub function.
let bathtubScope = ["duck", "sailorDuck", "rubberDuck", "realDuck"];
var bathtubScope = ["duck","rubberDuck","sailorDuck"];

//This array should contain the variable names (as strings) accessible in the pond function.
let pondScope = ["duck", "sailorDuck", "rubberDuck", "realDuck"];
var pondScope = ["duck","realDuck"];

//////////////////PROBLEM 14////////////////////

//Create a variable called age with your age assigned to you

// Code Here
var age=20;

// FLASH FORWARD TO NEXT YEAR
// reassign the value of age to be one greater than it was, because, we all get older

// Code Here
age++

// Good news! We can live forever. Set your age to 999

// Code Here
age=999;