Published
Edited
Sep 21, 2020
1 star
Insert cell
Insert cell
Insert cell
function funcaoConvencional(){
return "Funções são camelCase em js";
}
Insert cell
funcaoConvencional();
Insert cell
Insert cell
fc = funcaoConvencional;
Insert cell
fc();
Insert cell
Insert cell
f1 = function(a){ return a + "!!!"}
Insert cell
f1("olar");
Insert cell
Insert cell
f2 = x => x + " 👍";
Insert cell
f2("Oir")
Insert cell
Insert cell
sobre = function(denominador){
return function(numerador){
return numerador / denominador;
}
}
Insert cell
sobre10 = sobre(10);
Insert cell
sobre10(5)
Insert cell
{
const sobre5 = sobre(5);
return sobre5(5);
}
Insert cell
Insert cell
f3 = function(f, a){
return f(a);
}
Insert cell
fe = function(b){
return b + " - 🤙";
}
Insert cell
f3(fe, "uma mensagem")
Insert cell
Insert cell
f3(t => t + " 💎", "uma mensagem")
Insert cell
Insert cell
f4 = function(f, a, b){
return f(a, b);
}
Insert cell
f4( (x,y) => x + y + " 📮📮📮", "outra ", " mensagem")
Insert cell
Insert cell
Insert cell
[
1 === 1, // true
1 === 2, // false
1 === "1", // false
1 == "1", // true
1 == 2 // false
]
Insert cell
Insert cell
"Qualquer coisa".length;
// "Sem parêntese".length() --> ERRO
Insert cell
Insert cell
myArray = ["Hello", 45, true];
Insert cell
Insert cell
myArray[0];
Insert cell
{
myArray.push("World");
return myArray.length;
}
Insert cell
{
myArray[3] = "🌝";
myArray[4] = "🌞";
return myArray;
}
Insert cell
Insert cell
Insert cell
myObj = ({key1: "Hello", key2: "World"});
Insert cell
Insert cell
myObj2 = ({myKey: "myValue", "my other key": 4})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more