10 Trips & Ticks in JavaScript

1. substr()

example: substr()

var name= “Md. Azad Hosen”;
var result= name.substr(3, 9);
alert(result);

2. Array.splice()

const name = [‘azad’, ‘monir’, ‘raihan’, ‘karim’];
name.splice(1, 0, ‘tarek’);
console.log(name);
name.splice(4, 1, ‘Halim’);
console.log(name);

3. Array.slice()

example:
let student = [‘rahim’, ‘karim’, ‘mokles’, ‘tarikul’];
let result= student.slice(2)
console.log(result);

4. Array.Sort()

example:
let student = [‘rahim’, ‘karim’, ‘mokles’, ‘tarikul’];
let result= student.sort()
console.log(result);

5. Array.reverse()

example:
let student = [‘rahim’, ‘karim’, ‘mokles’, ‘tarikul’];
let result= student.reverse()
console.log(result);

6. String.indexOf()

Example:
‘hello world’.indexOf(‘’) // returns 0
‘hello world’.indexOf(‘’, 8) // returns 8

--

--

I am AK Azad, I am studying computer science and engineering

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ak Azad

I am AK Azad, I am studying computer science and engineering