For each problem, copy the code to a JS Bin. The only tabs needed are Javascript and Console. Try to complete the entire program before hitting "run" to check your work.
// Write a function above these comments called
// "processReplies" which takes in an array of
// comments (strings). For each comment, if it
// is longer than 10 characters, log "Approved"
// to the console. Otherwise, log "Rejected".
// Should log:
// "Approved"
// "Rejected"
// "Approved"
// "Rejected"
// "Rejected"
console.log("Processing feedback for nostalgic cash grab...");
processReplies(["I had a terrible time", "boo", "Worst movie I've ever seen", "", "trash"]);
// Should log:
// "Rejected"
// "Approved"
// "Rejected"
// "Approved"
// "Approved"
console.log("Processing feedback for other nostalgic cash grab...");
processReplies(["Wow!", "What a great show", "#win", "instant classic", "I can never watch another movie again"]);
// Should log:
// "Approved"
// "Rejected"
// "Rejected"
// "Approved"
// "Rejected"
console.log("Processing feedback from experiment 2A...");
processReplies(["Movin' pictures?!", "Ah!", "A witch!", "Burn them at the stake!", "Burn!"]);// Write a function "isInArray" above these comments that
// takes in an array of strings, and a single string,
// and returns true if the single string is in the
// array or false if it is not.
//
// Should print true
console.log(isInArray(["cat", "dog", "elephant", "frog", "goat"], "cat"));
// Should print false
console.log(isInArray(["cat", "dog", "elephant", "frog", "goat"], "bat"));
// true
console.log(isInArray(["cat", "dog", "elephant", "frog", "goat"], "goat"));
// false
console.log(isInArray(["cat", "dog", "elephant", "frog", "goat"], "donkey"));// Write a function "totalCharCount" above these comments
// that takes in an array of strings and returns the
// total character count from all of the strings added
// together.
//
// Should log 3
console.log(totalCharCount(["1", "2", "3"]));
// Should log 15
console.log(totalCharCount(["Hello", "dear", "friend"]));
// Should log 39
console.log(totalCharCount(["It", "was", "the", "best", "of", "times", "it", "was", "the", "worst", "of", "times"]));
// Should log 0
console.log(totalCharCount([""]));
// Should log 0
console.log(totalCharCount(["", "", ""]));// Write a function above these comments called
// "areArrayLengthsEqual" that takes in an array
// of arrays. If each of these sub-arrays has
// the same length, return true; if any two of
// them have different lengths, return false.
//
// Should return true
console.log(areArrayLengthsEqual([
[0, 1, 2, 3, 4],
["zero", "one", "two", "three", "four"]
]));
// Should return true:
console.log(areArrayLengthsEqual([
["blah", "blah", "blah"],
[0, 1, 2],
[null, null, null]
]));
// Should return false:
console.log(areArrayLengthsEqual([
[5, 4, 3, 2, 1],
[0, 1, 2, 3, 4],
["zero", "one", "two", "three", "four", "five"]
]));
// Should return false:
console.log(areArrayLengthsEqual([
[0, 1, 2, 3, 4],
["singularity"]
]));