+ 9
Why this code doesn't work?
12 Respostas
+ 5
console.log( [ "Even", "Odd" ] [ a % 2 ] );
It's an array with conditional index. The `a % 2` expression evaluates to 0 when <a> is an even number, and 1 when <a> is odd number.
The evaluation result of `a % 2` is used to decide which element is chosen from the array, to be printed into the console.
+ 6
Good stuff. [ a % 2] returns 0 or 1, and that takes "Even" or "Odd". ...talking to myself :)
+ 4
Sample Output:
"0 is even"
"1 is odd"
"2 is even"
+ 4
Vasiliy
You are an excellent programmer, I like your excellence and the cleanliness of your codes.
Input: "2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50 etc"
Output: even
Input: "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49 etc"
Output: odd
𝙶𝚛𝚎𝚎𝚝𝚒𝚗𝚐𝚜 𝚍𝚎𝚊𝚛 𝚏𝚛𝚒𝚎𝚗𝚍ヅ
+ 2
No problem bro because alert in js code alert<delete>then type console.log
+ 2
Odd + Odd = Even
Odd + Even = Odd
Even + Even = Even
Odd × Odd = Odd
Odd × Even = Even
Even × Even = Even
+ 1
Ipang, thank you)
+ 1
Juan Angel Luzardo Muslera
Another example of the output ☺️
Input: " "
Output: even
0
No problem bro 👌
0
console.log instead of alert
0
Juan Angel Luzardo Muslera
Thank you very much for your rating, but I still know too little to consider myself a programmer ☺️
0
hello.. everybody I want to known which books can help me to learn on how to create a virtual private Network (VPN)