⊗jsPmCdSE 109 of 504 menu

String equality in JavaScript

When using the if construct, strings can also be compared. For example, let the variable test store some string, for example 'abc':

let test = 'abc';

Let's check if the content of the variable test is equal to the string 'abc':

let test = 'abc'; if (test == 'abc') { console.log('+++'); // it will work } else { console.log('---'); }

Given the variables test1 and test2 containing strings. Check if their values are equal and display the corresponding message.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline