Javascript-форум (https://javascript.ru/forum/)
-   Оффтопик (https://javascript.ru/forum/offtopic/)
-   -   Красивый и могучий JS (https://javascript.ru/forum/offtopic/70611-krasivyjj-i-moguchijj-js.html)

рони 22.09.2017 21:16

Цитата:

Сообщение от рони
в том то и дело что x не равно undefined, но console.log(typeof х) выдаёт undefined



мдаааа ёршкин кот .... опечатка ха с икс перепутал

рони 22.09.2017 22:38

вопрос чему равен x ? :)
console.log((typeof x != 'string') && (x > 'x')); // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log( x == x && x > x) // true
console.log( x == x && x > x) // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log((typeof x != 'string') && (x > 'x')); // true
console.log( x == x && x > x) // true
console.log(typeof x)//object

Rasy 22.09.2017 23:06

Цитата:

Сообщение от рони
вопрос чему равен x ?

:write:
поцказка: x+x='wat'

ruslan_mart 23.09.2017 13:45

const x = {valueOf: () => 'y'}

join 25.09.2017 08:44

var x = ((i = 0)=>({ toString: ()=> --i }))();
console.log('1: ' + x + ' ,2: ' + x + ' ,3: ' + x + ' ,4: ' + x); //1: -1 ,2: -2 ,3: -3 ,4: -4
console.log((x == x) && (x > x)); //true


(-1 != -2) седовательно x == x //false

Где логика ?
В чем подвох ?
__
Понял. объекты сравниваются.


Часовой пояс GMT +3, время: 05:37.