Aula 2 - Variáveis e Tipos De Dados Flashcards

(15 cards)

1
Q

Pergunta

A

Resposta

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

O que é uma variável em JavaScript?

A

É um espaço na memória que guarda um valor para ser usado depois.

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

Qual a diferença entre let e const?

A

let permite mudar o valor depois; const mantém o valor fixo.

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

Como declarar uma variável usando let?

A

let nome = “Will”;

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

Como declarar uma constante usando const?

A

const idade = 30;

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

Quais são os principais tipos de dados em JavaScript?

A

String, Number, Boolean, Null, Undefined, Object e Array.

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

Como representar uma string?

A

Colocando o valor entre aspas: “texto”.

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

Como representar um número?

A

Sem aspas, como: 42 ou 3.14

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

Como representar um booleano?

A

true ou false

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

O que é null em JavaScript?

A

É um valor nulo, propositalmente vazio.

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

O que é undefined?

A

É quando a variável foi declarada mas não recebeu um valor.

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

Como declarar um objeto?

A

let pessoa = { nome: “Will”, idade: 30 };

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

Como declarar um array?

A

let frutas = [“maçã”, “banana”, “laranja”];

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

Como mostrar o valor de uma variável no console?

A

Usando console.log(variavel);

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

Como verificar o tipo de um valor?

A

Usando typeof valor

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