scrimba
Note at 0:34
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Note at 0:34
AboutCommentsNotes
Note at 0:34
Expand for more info
index.js
run
preview
console
/* Panic function 
Write a PANIC! function. The function should take in a sentence and return the same
sentence in all caps with an exclamation point (!) at the end. Use JavaScript's
built in string methods.

If the string is a phrase or sentence, add a 😱 emoji in between each word.

Example input: "Hello"
Example output: "HELLO!"

Example input: "I'm almost out of coffee"
Example output: "I'M 😱 ALMOST 😱 OUT 😱 OF 😱 COFFEE!"

.split() .join
*/

function panic(sentence) {
const panicSentence = sentence.split(' ').join(' 😱 ').toUpperCase().concat('!');
return panicSentence;
}

// Test your function
console.log(panic("I'm almost out of coffee"));
console.log(panic("winter is coming"))

Console
›
"I'M 😱 ALMOST 😱 OUT 😱 OF 😱 COFFEE!"
,
›
"WINTER 😱 IS 😱 COMING!"
,
/index.html
LIVE