Warm Up
Let's take 10 - 15
minutes to write a function that capitalizes a word
When you go on a job interview and are given a code challenge, you'll be able to look up JavaScript methods. But you won't be able to google 'how to capitalize a word using js'. The interviewers will be looking for your problem solving skills. So start building them by imagining this is for a job interview. Work through the steps. You've got this!
const capitalize = (word) => { // your code here}
capitalize('hello') // 'Hello'capitalize('howdy') // 'Howdy'capitalize('aloha') // 'Aloha'
#
Hungry for moreMake a function called
swapcase
that swaps the case - if a letter is lowercase make it uppercase and vice versaMake a function called
wackycase
- that lowercases the first letter and then alternates between making the following letters uppercase and lower case.- fun => fUn
- times => tImEs
eVeN mOaR bOnUs
- write a function that takes a sentence (multiple words) and uses your wackycase function to do the following:
serious fun times
should besErIoUs FuN tImEs
- write a function that takes a sentence (multiple words) and uses your wackycase function to do the following: