forked from LEARNAcademy/Assessments-2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Week-1.js
29 lines (16 loc) · 1.3 KB
/
Week-1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 1. Write an anonymous function that takes one argument of type number and decides if that number is evenly divisble by three or not. If it is, print the number and "is divisible by three". If it is not, print that the number "is not divisble by three".
// 2. Write about yourself using an object. Include at least three properties of you and store your object in a variable with your name.
// 3. Create an array with at least 4 items inside it. Show how to access two values from the array in two different ways.
// 4. Have the function AlphabetSoup(str) take the "str" parameter being passed and return a string with the letters in alphabetical order (ie. hello becomes ehllo). Assume no numbers or punctuation symbols will not be included in the parameter.
// Input:"hooplah"
// Output:"ahhloop"
function AlphabetSoup(str) {
// your code goes here
return str;
}
// keep this function call here
AlphabetSoup(readline());
// 5. Given the arrays below, use a for loop to print one value from each array concatenated together. How would your code need to change to accomodate arrays of different lengths?
var nums = [1, 5, 88, 2, 5, 42, 57, 101]
var nouns = ["ducks", "telephone booth", "the enterprise", "robots", "amazon", "eraser", "zafod", "a"]
// output of the first function should be: "1 ducks"