Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone tell me why 8>7<6 = true? [duplicate]

Can anyone tell me why

8>7<6 = true
12>10>2 = false

Please give answer enter image description here

Please Go through the image also

Thanks in Advance

like image 920
Rocky Avatar asked Jul 20 '18 09:07

Rocky


People also ask

What causes data duplication?

Data aggregation and human typing errors are some of the sources of duplicate data. Customers may also provide a company with different information at different points in time. Hence, businesses should consider removing duplicate records from their Database.

How do you duplicate data?

In addition to the ribbon buttons, you can use keyboard shortcuts for copy and paste. Control-c to copy; control-v to paste. Note that you can select more than one destination cell, and Excel will repeat the copied cells when they are pasted.


2 Answers

Here true = 1 and false =0 and expression evaluate from left to right

1) 8>7<6 = true

8>7 = true
true<6 = 1<6=true

2) 12>10>2 = false

12>10=true
  true>2 = 1>2= false
like image 53
Bhushan Kawadkar Avatar answered Sep 22 '22 16:09

Bhushan Kawadkar


In javascript the comaprison expression is evaluated from leftmost to right so

When you do 8 > 7 < 6, it undergoes the steps:

8 > 7 //true
true < 6 // true, since boolean value true is 1

Similarly when you do 12 > 10 >2, it undergoes the steps:

12 > 10 //true
true > 2 //false, since boolean value true is 1

Furthermore, you cannot assume that 12 > 10 > 2 will evaluate as a whole.

like image 32
Ankit Agarwal Avatar answered Sep 26 '22 16:09

Ankit Agarwal