- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
JavaScript: Find the Bug
This JavaScript quiz shows short functions with the kind of bugs that reach code review and production. You will predict the wrong result, name the error and choose the right fix for coercion, this, shallow copies, switch and loop bounds.
Pergunta de exemplo
Pergunta 1 de 10The total should be 15. What does this print instead?
function total(prices) {
let sum = 0;
for (const p of prices) sum += p;
return sum;
}
console.log(total(["5", "10"]));
Mostrar a resposta
B. 0510 The prices are strings (typical for form inputs or CSV). 0 + "5" is the string "05", and every later += concatenates. Convert first with Number(p).
O que este quiz cobre
- String concatenation instead of addition
- Returning from inside
forEach - Object identity in
includesand=== - Losing
thiswhen passing a method as a callback - Shallow copies,
switchfall-through and off-by-one loops
Perguntas frequentes
Preciso de uma conta?
Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.
Posso refazer?
Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.