Welcome to The Knowledge House 2021 Innovation Fellowship
Pre-work for the Web Development track!
The following prework is meant to assess your ability to learn new concepts
quickly and apply them to problems you may not have seen before.
Assignment 1:
Make your computer shout you out!
Now write a script where you initialize a javascript variable that can NOT be
changed
This solution and all other solution files should be saved in the pre-work directory
you will create:
assignment_1.js
Assignment 2:
Make your computer shout you out!
//Programming a computer seems complicated but in reality, it is just learning the commands
//your computer understands so you can make it do what you want it to do. The material does this
//to is data, that can be numbers, strings (sets of characters enclosed in “”), or a boolean which
//represents true and false, 0 or 1.
//In order for your computer to show text on a screen you must tell it what you want it to say with a
//console.log statement
//Ex1:
console.log(“Hello World”)
//Output would be: Hello World
// you can also capture strings and number and save them under names called variables:
var greeting = “Hello World”
console.log(greeting)
//Output would be: Hello World
//Ex 2
//You can also take words user’s input (or from other sources) and sub them into your string
//in the below example we have a variable that will save a users input for their favorite food:
fav_food = prompt(“What is your favorite food?”)
console.log( “My favorite food is ” + fav_food)
//OUTPUT:
//”What is your favorite food?: Burgers”
//My favorite food is Burgers
Now write a script where your computer asks you for your name and then shouts you
out
This solution should be saved in the pre-work directory you created earlier in the
file:
assignment_2.js
ASSIGNMENT 3
Simple Math:
Initialize two variables containing integers, multiply them, saving the result to a
third variable. Once done print the variable to the screen.
This solution should be saved in the pre-work directory you created earlier in the
file:
assignment_3.js
ASSIGNMENT 4
Math and evaluation
//Programming uses numbers, but thankfully you don’t need to be a math genius to program.
//Programming can be used to evaluate mathematical statements, you can also compare numbers to each-other
//Ex1:
4+4
//Output: 8
//Ex2:
17<3
//OUTPUT: False
//We can also place a condition on the result of such a test:
//Ex2
var example = 7;
if (example > 8){
print “over”
};
else{
print “under”
};
//OUTPUT: under
//You can do this to compare numbers to each-other
//Lastly we have arrays and loops, a array is just a collection of strings, numbers, or other pieces of data
var nums = [1,14,32,5,7]
console.log(nums.length;) //output is 5
//here we have a array of numbers we can write a for loop to array them out for us,
//Here we are setting the variable i to act as a placeholder for the item in the array we are printing
//i++ shows that after each run of the loop i is increased by 1, until i is greater than the length of the
//array
for(var i=0; i<nums.length; i++){
console.log(i)
};
//Output:
//1
Now create a loop that compares the array of numbers provided for the number 25,
console log over if it is over and under if it is under
over_under_array = [1,45,32,21,5,17,43,93]
This solution should be saved in your pre-work directory you created earlier in the
file:
assignment_4.js
ASSIGNMENT 5
Loops part 2:
var array = [1,45,32,21,5,17,43,93];
Given the above array, create a loop that goes through each array item, multiplies
it by 7 and then prints the result to the screen.
This solution should be saved in your pre-work directory your created earlier in the
file:
assignment_5.js
ASSIGNMENT 6
Given the below array, create a function which loops through each name, comparing
the length of each to determine the longest name, save that name to the variable
longest_name. Return longest_name to the another variable called answer and log the
answer variable to the screen.
var array = [ Retta, Vern, Marica, Cyrus, Linette, Curt, Nichole, Jesica, Wynell, Michaele ]
This solution should be saved in your pre-work directory your created earlier in the
file:
Assignment_6.js
ASSIGNMENT 7
Indexing
//all strings and arrays have individual characters and items respectfully represented by an index number
//this starts at 0, and can be accessed in bracket notation
var thing = “car”
thing[0]//c
thing[2]//r
array = [“one”,2,”3hree”]
array[2] // 3hree
//print both arrays and then return the even one and print it again.
Create a function that takes the below array of names, and separates them into two
arrays one of the names with an even number of letters and one with an odd number of
letters.
Then take the first letter of each of the names in the even array and make it the
letter “b”, take the last letter in each of the names in the odd array and make them
a “c”
Print both arrays and then return the even one to a variable named even_array and
print it again.
var names_array = [“bob”,”jimmy”,”max b”, “bernie”, “jordan”, “future hendrix”]
This solution should be saved in your pre-work directory your created earlier in the
file:
assignment_7.js
FINAL ASSIGNMENT:
Save all your solutions files in a folder called TKH_Prework
Now that all your solutions are saved to their files, your last step is to sign up
for and create a prework repo on Github.
Once the repo is created click on upload an existing file and select all your
solution files.
Once this is done, commit “Prework submitted” and upload them.
TO SUBMIT:
Draft an email to [email protected]
In the email subject line write “Full Name – Web Development”
Link the repo you created in the last step