10 Things a JS Developer Know

Sahil Imrose Zahin
1 min readMay 5, 2021

Number:

1.ParseFloat().

const example1 = “100”;parseFloat(example1) // to convert string to number

String:

2.String Length

‘Jhon’.length // to find how many characters in this string

3.String.charAt

‘hello’.charAt(3) // is a thing that returns the characters of strings to that location.

4.string.replace

‘hello, world’.replace(‘world’, ‘earth’)// to replace the old value to new value.

5.string.toUpperCase()

‘sahil’.toUpperCase()// to convert all string to upper case.

6.string.toLowerCase()

‘SAHIL’.toLowerCase()// to convert all string to lower case.

7.toString()

const stringObj = new String(‘foo’);console.log(stringObj);
// output
const toStaring = stringObj.toString()// convert object to stringconsole.log(toStaring);
// output

Array:

8.pop()

const plants = [‘broccoli’, ‘cauliflower’, ‘cabbage’, ‘kale’, ‘tomato’];const pop = plants.pop()// to remove last string of arrayconsole.log(pop)console.log(plants)// outputplants.pop();console.log(plants);// output

9.push()

const animals = [‘pigs’, ‘goats’, ‘sheep’];const count = animals.push(‘cows’);// to add a string after last string of arrayconsole.log(count)// output: 4console.log(animals)// outputanimals.push(‘chickens’, ‘cats’, ‘dogs’);// to add a string after last string of arrayconsole.log(animals)// output

10.slice()

const animals = [‘ant’, ‘bison’, ‘camel’, ‘duck’, ‘elephant’];const slice =animals.slice(2)// get the first two stringconsole.log(slice);console.log(animals)// expected outputanimals.push(‘chickens’, ‘cats’, ‘dogs’);console.log(animals)// expected output

--

--