scrimba
Prompt Engineering
AI Assisted Coding
Challenge: Convert Code
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Challenge: Convert Code
Expand for more info
index.js
run
preview
console
/* Challenge: Blast Off! https://chat.openai.com/

Prompt ChatGPT to convert the JQuery to plain JavaScript, and the Tailwind
code in index.css to plain CSS. Then click
the Blast Off button to see if it works. If you've converted successfully:

1. Clicking the Blast Off Button should start a countdown timer
2. The rocket ship should take off when the countdown reaches zero
*/

const $startButton = $('#startButton');
const $timerDisplay = $('#timer');
const $rocket = $('.rocket');

$startButton.click(() => {
let countdown = 3;

const intervalId = setInterval(() => {
$timerDisplay.text(countdown);

if (countdown === 0) {
clearInterval(intervalId);
rocketBlast();
}

countdown--;
}, 1000);
});

function rocketBlast() {
$rocket.css('display', 'block');
setTimeout(() => {
$rocket.css('transform', 'translateX(50vh) translateY(-150vh)');
}, 500);
}

Console
!
ReferenceError: $ is not defined
,
/index.html
-1:51