Day 2 of #100DaysOfCode!
Christian Falucho
Posted on June 18, 2021
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']
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]
💖 💪 🙅 🚩
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.