DEV Community

Cover image for 𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐛𝐞𝐭𝐰𝐞𝐞𝐧 𝐝𝐨𝐮𝐛𝐥𝐞 𝐞𝐪𝐮𝐚𝐥𝐬 == 𝐚𝐧𝐝 𝐭𝐫𝐢𝐩𝐥𝐞 𝐞𝐪𝐮𝐚𝐥𝐬 === 𝐢𝐧 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 ?
RUDRESH
RUDRESH

Posted on

𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐛𝐞𝐭𝐰𝐞𝐞𝐧 𝐝𝐨𝐮𝐛𝐥𝐞 𝐞𝐪𝐮𝐚𝐥𝐬 == 𝐚𝐧𝐝 𝐭𝐫𝐢𝐩𝐥𝐞 𝐞𝐪𝐮𝐚𝐥𝐬 === 𝐢𝐧 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 ?

Double equals== is used for 𝑐𝑜𝑚𝑝𝑎𝑟𝑖𝑛𝑔 𝑡𝑤𝑜 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠, but it 𝑖𝑔𝑛𝑜𝑟𝑒𝑠 the variable's datatype whereas Triple equals=== is used for comparing two variables, but this operator 𝑎𝑙𝑠𝑜 𝑐ℎ𝑒𝑐𝑘𝑠 𝑑𝑎𝑡𝑎𝑡𝑦𝑝𝑒.

== returns true only if the two operands are 𝑒𝑞𝑢𝑎𝑙 while === returns true only if two variables 𝑣𝑎𝑙𝑢𝑒𝑠 and 𝑑𝑎𝑡𝑎 𝑡𝑦𝑝𝑒𝑠 are the 𝑠𝑎𝑚𝑒.

Top comments (0)