Número aleatorio
//si queremos darle margen maximo de 0 a un numero positivo, multiplicamos
const randomTwo = Math.random() * 10 ;
document.write(`<h2>${randomTwo}</h2>`);
//quitamos los decimales
const randomThree = Math.floor(Math.random() * 10) ;
document.write(`<h2>${randomThree}</h2>`);
//guardamos n cantidad de randomNumbers en un array
//en este caso 10 randomNumbers, les damos el valor 0 con fill y
//luego calculamos su valor con map
const randomArray = new Array(3).fill(0).map(n => Math.floor(Math.random() * 10))
for (var i = randomArray.length - 1; i >= 0; i--) {
document.write(`${randomArray[i]}`)
Emoji aleatorio
var emojis = [
'😄','😃','😀','😊','☺','😉','😍','😘','😚','😗','😙',
'😜','😝','😛','😳','😁','😔','😌','😒','😞','😣','😢',
'😂','😭','😪','😥','😰','😅','😓','😩','😫','😨','😱',
'😠','😡','😤','😖','😆','😋','😷','😎','😴','😵','😲',
'😟','😦','😧','😈','👿','😮','😬','😐','😕','😯','😶',
'😇','😏','😑','👲','👳','👮','👷','💂','👶','👦','👧','👨',
'👩','👴','👵','👱','👼','👸','😺','😸','😻','😽','😼','🙀',
'😿','😹','😾','👹','👺','🙈','🙉','🙊','💀','👽','💩','🔥','✨',
'🌟','💫','💥','💢','💦','💧','💤','💨','👂','👀','👃','👅','👄','👍',
'👎','👌','👊','✊','✌','👋','✋','👐','👆','👇','👉','👈','🙌','🙏','☝',
'👏','💪','🚶','🏃','💃','👫','👪','👬','👭','💏','💑','👯',
'🙆','🙅','💁','🙋','💆','💇','💅','👰','🙎','🙍','🙇','🎩',
'👑','👒','👟','👞','👡','👠','👢','👕','👔','👚','👗','🎽',
'👖','👘','👙','💼','👜','👝','👛','👓','🎀','🌂','💄','💛',
'💙','💜','💚','❤','💔','💗','💓','💕','💖','💞','💘','💌',
'💋','💍','💎','👤','👥','💬','👣','💭','🐶','🐺','🐱','🐭',
'🐹','🐰','🐸','🐯','🐨','🐻','🐷','🐽','🐮','🐗','🐵','🐒',
'🐴','🐑','🐘','🐼','🐧','🐦','🐤','🐥','🐣','🐔','🐍','🐢',
'🐛','🐝','🐜','🐞','🐌','🐙','🐚','🐠','🐟','🐬','🐳','🐋',
'🐄','🐏','🐀','🐃','🐅','🐇','🐉','🐎','🐐','🐓','🐕','🐖',
'🐁','🐂','🐲','🐡','🐊','🐫','🐪','🐆','🐈','🐩','🐾','💐',
'🌸','🌷','🍀','🌹','🌻','🌺','🍁','🍃','🍂','🌿','🌾','🍄',
'🌵','🌴','🌲','🌳','🌰','🌱','🌼','🌐','🌞','🌝','🌚','🌑',
'🌒','🌓','🌔','🌕','🌖','🌗','🌘','🌜','🌛','🌙','🌍','🌎',
'🌏','🌋','🌌','🌠','⭐','☀','⛅','☁','⚡','☔','❄','⛄','🌀',
'🌁','🌈','🌊','🎍','💝','🎎','🎒','🎓','🎏','🎆','🎇','🎐','🎑',
'🎃','👻','🎅','🎄','🎁','🎋','🎉','🎊','🎈','🎌','🔮','🎥','📷',
'📹','📼','💿','📀','💽','💾','💻','📱','☎','📞','📟','📠','📡',
'📺','📻','🔊','🔉','🔈','🔇','🔔','🔕','📢','📣','⏳','⌛','⏰',
'⌚','🔓','🔒','🔏','🔐','🔑','🔎','💡','🔦','🔆','🔅','🔌','🔋',
'🔍','🛁','🛀','🚿','🚽','🔧','🔩','🔨','🚪','🚬','💣','🔫','🔪',
'💊','💉','💰','💴','💵','💷','💶','💳','💸','📲','📧','📥','📤',
'✉','📩','📨','📯','📫','📪','📬','📭','📮','📦','📝','📄','📃','📑',
'📊','📈','📉','📜','📋','📅','📆','📇','📁','📂','✂','📌','📎','✒',
'✏','📏','📐','📕','📗','📘','📙','📓','📔','📒','📚','📖','🔖','📛',
'🔬','🔭','📰','🎨','🎬','🎤','🎧','🎼','🎵','🎶','🎹','🎻','🎺','🎷',
'🎸','👾','🎮','🃏','🎴','🀄','🎲','🎯','🏈','🏀','⚽','⚾','🎾','🎱',
'🏉','🎳','⛳','🚵','🚴','🏁','🏇','🏆','🎿','🏂','🏊','🏄','🎣',
'☕','🍵','🍶','🍼','🍺','🍻','🍸','🍹','🍷','🍴','🍕','🍔','🍟','🍗',
'🍖','🍝','🍛','🍤','🍱','🍣','🍥','🍙','🍘','🍚','🍜','🍲','🍢','🍡',
'🍳','🍞','🍩','🍮','🍦','🍨','🍧','🎂','🍰','🍪','🍫','🍬','🍭','🍯',
'🍎','🍏','🍊','🍋','🍒','🍇','🍉','🍓','🍑','🍈','🍌','🍐','🍍','🍠',
'🍆','🍅','🌽','🏠','🏡','🏫','🏢','🏣','🏥','🏦','🏪','🏩','🏨','💒',
'⛪','🏬','🏤','🌇','🌆','🏯','🏰','⛺','🏭','🗼','🗾','🗻','🌄','🌅',
'🌃','🗽','🌉','🎠','🎡','⛲','🎢','🚢','⛵','🚤','🚣','⚓','🚀','✈',
'💺','🚁','🚂','🚊','🚉','🚞','🚆','🚄','🚅','🚈','🚇','🚝','🚋','🚃',
'🚎','🚌','🚍','🚙','🚘','🚗','🚕','🚖','🚛','🚚','🚨','🚓','🚔','🚒',
'🚑','🚐','🚲','🚡','🚟','🚠','🚜','💈','🚏','🎫','🚦','🚥','⚠','🚧','🔰',
'⛽','🏮','🎰','♨','🗿','🎪','🎭','📍','🚩','⬆','⬇','⬅','➡','🔠','🔡',
'🔤','↗','↖','↘','↙','↔','↕','🔄','◀','▶','🔼','🔽','↩','↪','ℹ','⏪',
'⏩','⏫','⏬','⤵','⤴','🆗','🔀','🔁','🔂','🆕','🆙','🆒','🆓','🆖',
'📶','🎦','🈁','🈯','🈳','🈵','🈴','🈲','🉐','🈹','🈺','🈶','🈚','🚻',
'🚹','🚺','🚼','🚾','🚰','🚮','🅿','♿','🚭','🈷','🈸','🈂','Ⓜ','🛂',
'🛄','🛅','🛃','🉑','㊙','㊗','🆑','🆘','🆔','🚫','🔞','📵','🚯','🚱',
'🚳','🚷','🚸','⛔','✳','❇','❎','✅','✴','💟','🆚','📳','📴','🅰','🅱',
'🆎','🅾','💠','➿','♻','♈','♉','♊','♋','♌','♍','♎','♏','♐','♑',
'♒','♓','⛎','🔯','🏧','💹','💲','💱','©','®','™','〽','〰','🔝','🔚','🔙',
'🔛','🔜','❌','⭕','❗','❓','❕','❔','🔃','🕛','🕧','🕐','🕜','🕑','🕝',
'🕒','🕞','🕓','🕟','🕔','🕠','🕕','🕖','🕗','🕘','🕙','🕚','🕡','🕢',
'🕣',
'🕤','🕥','🕦','✖','➕','➖','➗','♠','♥','♣','♦','💮','💯','✔','☑','🔘',
'🔗','➰','🔱','🔲','🔳','◼','◻','◾','◽','▪','▫','🔺','⬜','⬛','⚫','⚪',
'🔴','🔵','🔻','🔶','🔷','🔸','🔹'
];
const emojiFun = () => {
return emojis[Math.floor(Math.random() * emojis.length)];
}
//2 ways to get them
const randomEmoji = document.getElementById('randomEmoji')
randomEmoji.innerHTML = `This element do exists and we edit it. Press F5${emojiFun()} }.`;
console.log(`We created this element. Press F5 and get emojis ${emojiFun()}`);