Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Snail Game | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Essential TypeScript Basics for JavaScript Developers - 1768407373799

bookChallenge: Snail Game

Task

Congratulations, you've been hired as a developer for the indie game 'Snail Simulator.' Your goal is to design the snail's movement logic. Snails are not very fast, and each snail has its own stamina. You need to calculate the maximum distance the snail will travel if it spends 2% of its stamina for every meter it covers. Use a while loop to solve this problem and then display the result on the screen. Good luck!

123456789
let stamina: number = 100; let distance: number = 0; const staminaPerMeter: number = 2; while (stamina > ___) { stamina = ___ - ___; ___++; } console.log(`The snail got tired; it ran ${___} meters. This is a new record, congratulations!`)
copy

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 23

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

bookChallenge: Snail Game

Desliza para mostrar el menú

Task

Congratulations, you've been hired as a developer for the indie game 'Snail Simulator.' Your goal is to design the snail's movement logic. Snails are not very fast, and each snail has its own stamina. You need to calculate the maximum distance the snail will travel if it spends 2% of its stamina for every meter it covers. Use a while loop to solve this problem and then display the result on the screen. Good luck!

123456789
let stamina: number = 100; let distance: number = 0; const staminaPerMeter: number = 2; while (stamina > ___) { stamina = ___ - ___; ___++; } console.log(`The snail got tired; it ran ${___} meters. This is a new record, congratulations!`)
copy

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 23
some-alt