Modo entrevista. Temporizador de 4 min, sin pistas y sin autocompletado
Your own error
FácilErrors4 min
Write a class FormatError for errors in a data format. It extends the built-in SyntaxError. For new FormatError('bad date') the message field is 'bad date' and the name field is 'FormatError'.
Ejemplos
new FormatError('bad date').messageDevuelve 'bad date'
new FormatError('bad date').nameDevuelve 'FormatError'
new FormatError('bad date') instanceof SyntaxErrorDevuelve true
Cargando el editor…
- message comes from the constructor, name is FormatError
- The error is a FormatError, a SyntaxError and an Error
Las pruebas ocultas se ejecutan al enviar