This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showNameAndAge({name = 'Ricardo', age = 32}){ | |
return `Hello ${name}, you are ${age} years old`; | |
} | |
showNameAndAge({name: 'Ricardo', age: 32}); //right | |
showNameAndAge({age: 32, name: 'Ricardo'}); //also right! | |
showNameAndAge(); //also right! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const profile = { | |
name: 'Ricardo', | |
age: 32, | |
eyes: 'Brown', | |
orign: 'Brazil', | |
occupation: 'Fullstack dev' | |
}; | |
const { name, age } = profile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1.0, user-scalable=0, shrink-to-fit=no"> | |
<meta name="HandheldFriendly" content="true"> | |
<title>Your application title</title> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>Welcome to the real-time HTML editor!</h3> | |
<p>Type HTML in the textarea above, and it will magically appear in the frame below.</p> | |
<iframe id="dddjhj" src="https://htmledit.squarefree.com/conteudo1" style="width: 100%" /></iframe> | |
<button onclick="document.getElementById('dddjhj').src = 'https://htmledit.squarefree.com/conteudo2'"> mudar </button> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function changeContent(idx){ | |
var content = [ | |
{text: "flavio", img: "https://i.pinimg.com/originals/81/6d/a5/816da533638aee63cfbd315ea24cccbd.jpg" }, | |
{text: "ricardo", img: "https://ih1.redbubble.net/image.369380617.6838/flat,800x800,075,f.u4.jpg" }, | |
{text: "antonio", img: "https://static.boredpanda.com/blog/wp-content/uploads/2017/03/Evil-Cats-Demons-Summoning-Satan-125-58d223c94bf80__605.jpg" }, | |
] | |
document.getElementById('btn'+idx).innerHTML = content[idx].text; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const people = { | |
aline: 26, | |
john: 35, | |
peter: 21, | |
james: 45 | |
}; | |
const getAge = name => people[name]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const people = [ | |
{ name: 'lucy', age: 13}, | |
{ name: 'aline', age: 13}, | |
{ name: 'john', age: 35}, | |
{ name: 'peter', age: 21}, | |
{ name: 'james', age: 45}, | |
{ name: 'marcela', age: 17}, | |
]; | |
const getGreaterThan18 = () => people.filter(person => person.age > 18); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const printItemAndNext = (...items) => | |
items.forEach((item, index) => | |
items.forEach( | |
(innerItem, innerIndex) => | |
innerIndex === index + 1 && console.log(item, innerItem), | |
), | |
); | |
/* will return: | |
1 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const printItemAndNextItem = (...items) => | |
items.forEach( | |
(item, index) => items[index + 1] && console.log(item, items[index + 1]), | |
); | |
/* will return: | |
1 2 | |
2 3 | |
3 4 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const people = [ | |
{ | |
name: "Joseph", | |
age: 32, | |
gender: "male", | |
}, | |
{ | |
name: "Anna", | |
age: 27, | |
gender: "female", |