GoConqr has a new look! Let us know what you think.

Module 8 of 35 · Text

#08

welligton costa

/ **

Vamos olhar para o futuro usando uma Magic 8 Ball!

https://en.wikipedia.org/wiki/Magic_8-Ball

Existem algumas etapas para poder visualizar o futuro:

* Faça uma pergunta

* Agite a bola

* Obter uma resposta

* Decida se é positivo ou negativo

A pergunta pode ser qualquer coisa, mas as respostas são fixas,

e têm diferentes níveis de positividade ou negatividade.

Abaixo estão as respostas possíveis:

## Muito positivo

É certo.

É decididamente assim.

Sem dúvida.

Sim definitivamente.

Você pode contar com ele.

## Positivo

A meu ver, sim.

Provavelmente.

Outlook bom.

Sim.

Sinais apontam que sim.

## Negativo

Resposta nebulosa, tente novamente.

Pergunte novamente mais tarde.

Melhor não te dizer agora.

Não posso prever agora.

Concentre-se e pergunte novamente.

## Muito negativo

Não conte com isso.

Minha resposta é não.

Minhas fontes dizem não.

Outlook não é tão bom.

Muito duvidoso.

* /

// Isso deve registrar "A bola tremeu!"

// e retorna a resposta.

 

 

function shakeBall() {}

// A resposta deve vir sacudindo a bola

let answer;

// Ao verificar a resposta, devemos dizer a alguém se a resposta é

// - muito positivo

// - positivo

// - negativo

// - muito negativo

function checkAnswer() {}

/* ======= TESTS - DO NOT MODIFY ===== */

const log = console.log;

let logged;

console.log = function() {

log(...arguments);

logged = arguments[0];

};

function test(test_name, expr) {

let status;

if (expr) {

status = "PASSED";

} else {

status = "FAILED";

}

logged = undefined;

console.log(`${test_name}: ${status}`);

}

const validAnswers = [];

function testAll() {

const answer = shakeBall();

test(

`shakeBall logs "The ball has shaken!"`,

logged === "The ball has shaken!"

);

test(`shakeBall returns an string answer"`, typeof answer === "string");

test(

`checkAnswer returns the level of positivity"`,

["very positive", "positive", "negative", "very negative"].includes(

checkAnswer(answer)

)

);

}

testAll();

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?