Photo by Oğuzhan Akdoğan on Unsplash

When is it needed?


Photo by Gratisography from Pexels
arr.findIndex(callback( element, index, array ) ,thisArg)


Photo by Snapwire from Pexels


Photo by Dan-Cristian Pădureț on Unsplash


Image taken here.

Example

let numbersStr = "1,2,3,4,5";let numArray = numbersStr.split(",");console.log(numArray); // ["1","2","3","4","5"]


Learn how to make requests using XMLHttpRequests

summary of key XMLHttpRequest commands covered in this article
Image source: Author

What Is XMLHttpRequest (XHR)?

Steps to Make a Request Using XMLHttpRequest

1. Create a XMLHttpRequest object

let request = new XMLHttpRequest();

2. Configure the object with request details


Photo by Deva Darshan on Unsplash

Checking if a primitive value present in an array

var num = [1,2,3,4,5];

indexOf

num.indexOf(3); // 2num.indexOf(6); //-1num.indexOf('3'); // -1
var array = [NaN];array.indexOf(NaN); // -1


Image by Vladislav

Javascript Jeep🚙💨

Articles related to JavaScript.

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