How to set condition between data types in javasScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to set condition between data types in javasScript

26th Jan 2020, 6:21 AM
🇧🇩Muhammad iAR HOSSAIN🇧🇩
🇧🇩Muhammad iAR HOSSAIN🇧🇩 - avatar
7 Answers
+ 2
🇧🇩EkmuthoSopno🇧🇩 yes, you can. Try this var a = 20; var b =20; if (typeof a == typeof b ){ console.log("This is data type of a and b is ", typeof a) }
26th Jan 2020, 2:45 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
+ 1
Be more specific. Do you want a boolean? Between an int and a string? Show us code.
26th Jan 2020, 6:54 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 1
You can do this if (typeof 9 == typeof 10) { console.log("hello"); }
26th Jan 2020, 11:37 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
+ 1
Thanks bro
26th Jan 2020, 2:46 PM
🇧🇩Muhammad iAR HOSSAIN🇧🇩
🇧🇩Muhammad iAR HOSSAIN🇧🇩 - avatar
+ 1
🇧🇩EkmuthoSopno🇧🇩 welcome bro. Here, we all are learners.
26th Jan 2020, 2:50 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
Please use only relevant words and avoid writing your question into the tags. For future reference please follow this tips on posting a question 👍 https://www.sololearn.com/Discuss/333866/?ref=app
26th Jan 2020, 7:14 AM
Ipang
0
Vivek:- Can I use a variable name after typeof?
26th Jan 2020, 2:10 PM
🇧🇩Muhammad iAR HOSSAIN🇧🇩
🇧🇩Muhammad iAR HOSSAIN🇧🇩 - avatar