Funções + logica Flashcards

1
Q

O que é uma função

A

um conjunto de instruções que executa uma tarefa ou calcula um valor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

function

A

function algumaCoisa(){
conosle.log(bloco-de-codigos )
}

algumaCoisa()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

functions com parâmetros

A

function speedUp(acceleration, velocity){
let newSpeedUp = acceleration + velocity
console.log(Nova velocidade: ${newSpeedUp}Km)
}

speedUp (10, 50)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Parâmetros (Com valor padrão)

A

function namePerson(name, message = “Olá”){
alert(message + “, “ + name)
}

namePerson (“Taylor Vitor”, “Seja bem-vindo”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

anonymous function

A

let show = function () {
console.log(“Função sem nome”)
}
show();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

function expression

A

const numbers = function () {
console.log(1, 2, 3, 4)
}

numbers()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

função e método

A

const names = “taylor”

// funções

const sayHi = () => “Oi”

const greet = sayHi()
console.log(greet)

// Método

const nameUpCase = names.toUpperCase()
console.log(nameUpCase)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly