10 things you need to know for having a GF as a JS developer

Md. Abul Hasan Nur Rafi
3 min readMay 5, 2021

1. The includes() make you safe either you include your GF name to your love letter or not

includes() is a case-sensitive function because it returns true or false depends on the character stay in your writing or not

const sentence = ‘See you soon Sokina’;
const word = ‘Sokina’;

console.log(`The word “${word}” ${sentence.includes(word) ? ‘is’ : ‘is not’} in the sentence`);
// expected output: “The word “Sokina” is in the sentence”

2. Write the full name of your girlfriend with String.concat()

concat() gives you permission to send a love letter to your girlfriend with her full name

const firstName= ‘Sokina’;
const secondName= ‘Jorina’;
console.log(firstName.concat(‘ ‘, secondName));
// expected output: “Sokina Jorina”

3. It’s time to send a love letter using String.charAt()

JavaScript gives us an interesting function to find whether the first character of your love letter started with your girlfriend’s name or not, and the function is charAt(). Let’s have a look at this function.

var loveLetter= ‘Sokina love’
console.log(loveLetter.charAt(0));
// expected output: “S”

4. The endsWith() saves you from the breakup

endsWith() method searches the specific string in a sentence. such as if you don't say good night to your GF then the next morning your GF will flew with another boy and say you break up. So be careful and keep remember that you say good night if you forget then search with endWith() method.

const say= ‘bye bye, beb good night’;
console.log(say.endsWith(‘night’));
// expected output: true

5. When You have got another GF then make a list with push()

push() method add an element at the last of the array.

const animals = [‘Sokina’, ‘Jorina’];
animals.push(‘Carina’);
console.log(animals);
// expected output: Array [‘Sokina’, ‘Jorina’, ‘Carina’]

6. The reverse() swings your GF mind.

reverse() method reverse the full array, like your GF mind. such sometimes your GF want to go park after that riverside but after a few minutes, she wants to go riverside first and after the park.

const willGo= [‘park’, ‘riverside’];
console.log(‘GF will go:’, willGo);
// expected output: “GF will go:” Array [‘park’, ‘riverside’]

const reversed = willGo.reverse();
console.log(‘reversed:’, reversed);
// expected output: “reversed:” Array [‘riverside’, ‘park’]

7. startsWith() must-have in your holy text.

sometimes you need to say sorry to your girlfriend but be careful if you forget to mention her name then she might think you must texting to another girl, for this reason, javascripts has a great solution and it is startsWith(). startsWith() gives you true or false.

const saySorry= ‘Sokina sorry’;
console.log(saySorry.startsWith(‘Sokina’));
// expected output: true

8. Last GF Break up? no problem use pop()

Suppose you have recently breakup with your last GF in you array & you don’t want to stay her into your array then simply use pop() method.

const gfList= [‘Sokina’, ‘Jorina’, ‘Carina’];
console.log(gfList.pop());
// expected output: “Carina”

console.log(gfList);
// expected output: Array [“Sokina”, “Jorina”]

9. Let’s have a look in trimStart()

This trimStart() method remove all the white space from a string from the begining.

const say= ‘    Hello Rafiiii‘;
console.log(say);
// expected output: “ Hello Rafiiii“;
console.log(say.trimStart());
// expected output: “Hello Rafiiii“;

10. How slice() work !!

slice() method make a new string without modifying the original string. it always follow the index to make a new string

const str = ‘I am looking for a job’;
console.log(str.slice(5));
// expected output: “tlooking for a job”

--

--

Md. Abul Hasan Nur Rafi
0 Followers

I am a high voltage powered react js web developer