Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

compare strings js

const s1 = 'learn';
const s2 = 'today';

console.log(s1 === 'learn');  // true
console.log(s1 === s2);       // false
Comment

javascript string compare

employees.sort((a, b) => {
    let fa = a.firstName.toLowerCase(),
        fb = b.firstName.toLowerCase();

    if (fa < fb) {
        return -1;
    }
    if (fa > fb) {
        return 1;
    }
    return 0;
});
Code language: JavaScript (javascript)
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript function return boolean 
Javascript :: get url 
Javascript :: javascript round to nearest integer 
Javascript :: mail 
Javascript :: npm react-device-detect 
Javascript :: javascript first letter uppercase 
Javascript :: function declaration and function definition in javascript 
Javascript :: boucle foreach js 
Javascript :: how to swap two images in javascript 
Javascript :: initalise typed js library 
Javascript :: vuetify sass variables vue-cli 
Javascript :: how to send js array from ajax 
Javascript :: javascript append list 
Javascript :: p5.js how to display a text from string 
Javascript :: iframe url redirect 
Javascript :: getmonth js 
Javascript :: array remove first element js 
Javascript :: threemeshphonematerial url image three js 
Javascript :: javascript unique array 
Javascript :: for i in range vue js 
Javascript :: load.json 
Javascript :: node save wav base64 
Javascript :: javascript single thread 
Javascript :: change module name react native android studio 
Javascript :: jquery ajax download file 
Javascript :: react-query dependent query 
Javascript :: jquery add attribute without value 
Javascript :: use of split and join 
Javascript :: javascript update value when slider moves javascript 
Javascript :: remove id from array javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =