Day 2 of #100DaysOfCode!

cfalucho

Christian Falucho

Posted on June 18, 2021

Day 2 of #100DaysOfCode!

Today's progress🤖

Successful day! I tackled on more Basic Algorithm Scripting
problems from freeCodeCamp. Learned and used a wide set of methods, slice() splice() indexOf(). A combination of methods can really help to solve algorithms. So reading and really understanding what they do helps.

What I learned

split() method divides a string into an ordered list of substrings and returns an array.

let string = "I'm a little tea pot"

let arr = string.split(' ');

//output: ['I'm', 'a', 'little', 'tea', 'pot']
Enter fullscreen mode Exit fullscreen mode

Now that we have the string into an array. We can loop through the array and take the first letter of each word and replace it using the toUpperCase method

splice() method modifies an existing array by removing, replacing or adding existing elements.

let numbers = ['one', 2, 4, 'five', 'six', 7]

numbers.splice(2, 0, 'three')  


//output ['one', 2, 'three', 4, 'five', 'six', 7]
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
cfalucho
Christian Falucho

Posted on June 18, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Day 2 of #100DaysOfCode!
beginners Day 2 of #100DaysOfCode!

June 18, 2021