Guia de entrevista · JavaScript

What are the types of Functions in JavaScript?

do caderno de estudos · atualizado em 2 de outubro de 2026
Para quem vai encarar entrevista de JavaScript2 min

Parece simples até o entrevistador perguntar "why?". Abaixo, uma estrutura de resposta que dá conta do follow-up.

A resposta, como você fala na entrevista

Function Declaration: its binding is initialized with the function before the scope's statements execute, so it can usually be called before its declaration line.
Function Expression: the function value is created when the expression runs. For const fn = function () {}, fn is in the TDZ before initialization. For var fn = function () {}, fn is initially undefined, so calling it too early throws TypeError.
Arrow Function: inherits this and arguments from the surrounding scope. It cannot be called with new.

Trap: an arrow used as an object property does not acquire that object as this. Use a regular method when the receiver should depend on the call.

Pegadinha clássica

Essa pergunta tem uma armadilha que derruba muita gente em entrevista. Ela está marcada na resposta acima: vale reler antes de treinar.

Ler é o primeiro passo. No app, essa pergunta vira flashcard com repetição espaçada, e o módulo tem quiz e simulado para testar o que ficou.

Treinar essa pergunta no app