Sprint 12:51 AM 62%) metrostate.learn.minnstate.edu Assignment #3 JavaScript Pro
ID: 3754287 • Letter: S
Question
Sprint 12:51 AM 62%) metrostate.learn.minnstate.edu Assignment #3 JavaScript Problems. I have a pile of JavaScript problems for you in this assignment. Do all of these. You may throw them all in one file with your name at the top as a comment. Do each problem as its own function, and call each function for me in the file itself so it's easy for me to test! When I say print/display, use console.log0. If you've had 141 already, these should be cake. If not, they might be a bit tougher Make a function that takes in a single input assumed to be an integer. Run a for loop that prints "HI BOB" an amount equal to that integer 2. Do the same, but pass two parameters, the amount and a message to be displayed. Instead of "HI BOB", print the passed message the desired amount of times. 3 Write a function that displays the following table... 1 2345 6 7 89 10 11 12 13 1415 4. Write a function that displays output according to this table. Pass in a floating point value, assumed to be a star rating. Use decisions. experience with switches! Rating Message Consider using a switch if you have no 0 Terible 0-2.5 Not Great 4 Aght 5 DopeExplanation / Answer
Please find the code below.
CODE
====================
function problem1(num) {
for(let i=1; i<=num; i++) {
console.log("HI BOB");
}
}
function problem2(num, message) {
for(let i=1; i<=num; i++) {
console.log(message);
}
}
function problem3() {
for(let i=1; i<=15; i++) {
console.log(i + " ");
if (i % 5 == 0) {
console.log(" ");
}
}
}
function problem4(rating) {
if (rating == 0) {
console.log("Terrible");
} else if (rating > 0 && rating <= 2.5) {
console.log("Not Great");
} else if (rating > 2.5 && rating <= 4) {
console.log("Alright");
} else if (rating > 4 && rating <= 5) {
console.log("Dope");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.