Difference between double equals == and triple equals === operator in javascript

if(appleprice == 100) 
console.log('1kg apple price rs.100);
const appleprice = 100; 
if(appleprice == 100)
console.log('1kg apple price rs.100);

How does this equality operator here actually work?

const appleprice = '100';
If(appleprice == 100)
console.log('1kg apple price rs.100);
1kg apple price rs.100 console -> true

For example:

const appleprice = '100'; 
If(appleprice === 100)
console.log('1kg apple price rs.100);
const appleprice = 100; 
If(appleprice === 100)
console.log('1kg apple price rs.100);
true 1kg apple price rs.100

Conclusion

--

--

DailyAspirants is one website for all begginers to learn website design and coding

Love podcasts or audiobooks? Learn on the go with our new app.

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