+ 2

how can I choose 2 random elements and change there value from no thing (undefined) to number (2 or 4) by JavaScript jQuery

i wanna make game 2048

8th Sep 2018, 9:54 AM
Ali Abdelrahim Alfaki Mohamed
Ali Abdelrahim Alfaki Mohamed - avatar
2 ответов
+ 4
var twoOrFour = Math.floor(Math.random()*2) ? 2:4; console.log(twoOrFour); https://code.sololearn.com/WiI2yQ0pQoQJ/?ref=app
8th Sep 2018, 11:21 AM
Calviղ
Calviղ - avatar
+ 1
Calviղ can you explain more by document elements
14th Sep 2018, 1:23 PM
Ali Abdelrahim Alfaki Mohamed
Ali Abdelrahim Alfaki Mohamed - avatar