Me ajuda a identificar o erro

7 respostas
javascript
Z

Show me the code!

Using the dot notation, access the given object so you can print the string Harry Potter, the boy who lived.

var wizard = {

name: Harry Potter,

nickname: the boy who lived

};

console.log(wizard.name, wizard.nickname);

Output

Code is incorrect

Your program is producing the wrong output

7 Respostas

D

Considerando que o teu objeto esteja correto, essa saída gera:

Harry Potter the boy who lived

O que é diferente, por não conter a vírgula.
Precisa pensar em uma maneira de adicionar esse sinal de pontuação.
Pensei nessas opções, mas não sei se alguma é válida

console.log(wizard.name, ',', wizard.nickname);
console.log(wizard.name + ',', wizard.nickname);
Harry Potter, the boy who lived
Z

me ajuda
Show me the code!

In the variable characters, assign an array of objects to organize the following names and respective quotes:

'A wizard is never late, nor is he early. He arrives precisely when he means to.' - Gandalf
'One does not simply walk into Mordor' - Boromir
'My precious.' - Gollum

Print the following output: ‘Boromir wisely said “One does not simply walk into Mordor”’.

var characters= [

{

name: Gandalf,

quote: A wizard is never late, nor is he early. He arrives precisely when he means to.

},

{

name: Boromir,

quote: ‘“One does not simply walk into Mordor”’

},

{

name: Gollum,

quote: My precious.

}

];

console.log(characters[1].name +  wisely said,characters[1].quote );

Output

Code is incorrect

One of the objects should have a property with key quote and the value ‘One does not simply walk into Mordor’

Boromir wisely said “One does not simply walk into Mordor”

D

As aspas não deveriam estar ali.

Z

me ajuda a encontrar o erro.please

ja tentei com e sem aspas mas nao da correto

D

Esse tipo de coisa é desnecessário e chato, cara.
Coloque a questão, explica e mostra o que fez.

Z
var characters= [

{

name: Gandalf,

quote: A wizard is never late, nor is he early. He arrives precisely when he means to.

},

{

name: Boromir,

quote: One does not simply walk into Mordor

},

{

name: Gollum,

quote: My precious.

}

];

console.log(characters[1].name +  wisely said,characters[1].quote );

Code is incorrect

Your program is producing the wrong output. Make sure you’re not including the single quotes.

Boromir wisely said One does not simply walk into Mordor

D

console.log(wizard.name+", "+wizard.nickname);

Criado 13 de fevereiro de 2020
Ultima resposta 26 de jul. de 2020
Respostas 7
Participantes 3