DevLog.at

sumplus's Devlogs

Developer, developer, developer, developer.

ProfileFollowing

I'm finally learning it for real instead of copy pasting from generators. Woohoo!

// - that's what you put your regex pattern inside

/funFunfun/ will match funFunfun but not FunFunFun, funfunfun or any other variant

2m

But let's say we do want to match all the case variations of funFunfun including FunFunFun, funfunfun etc...

Add the letter i to the end like so: /funFunfun/i

The letter i is one type of 'flag' that modifies regex search

2m

I love freeCodeCamp. Such a generous source of free web dev lessons for newbies. I even donated $$ because they deserve it <333... but there's a scattering of confusing or questionable stuff that comes up. I guess that's normal with beginner tutorials. Here's a small compilation for anyone interested

2m

From ES6 lesson on spread operators...

Why do this to copy an array:

const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
arr2 = [...arr1];

instead of

arr2 = arr1;

I figured it out through forum search and video and it makes sense. We want a copy of the original array (two different arrays) not one array with two variables pointing at it. Spread operator created a copy. It wasn't explained so the lesson felt pointless at first... but that's cool to know!

2m

I just realized I can chain together stuff like higher order functions!

array.filter(do something...).map(etc....).reduce(etc....)

chain train!

2m

and it looks better with ES6 arrow functions

2m

Just started ES6 intro on freeCodeCamp. It's cool so far. let and const > var

3m

At first I thought Array.slice() was weird. It takes two arguments representing array indexes. Why is the first argument inclusive (includes the element at that array index) and second argument exclusive?

But now it makes sense - array.length can be used as the second argument and that would extract the last array element.

var fruits = ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'];
var citrus = fruits.slice(1, 3);
var moreThanCitrus = fruits.slice(1, fruits.length);

// fruits contains ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango']
// citrus contains ['Orange','Lemon']
// moreThanCitrus contains ['Orange','Lemon', 'Apple', 'Mango']

2m

sumplus

4 devlogs

Member Since Aug 2019