Javascript Coding - Spot That Error 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Name:

Teacher:
Date:

JavaScript Code – Spot That Error!

Each problem consists of a line or lines of code that have errors. If it is a single line of code, there is a
single error, but multiple lines of code may have multiple errors. Please write the correct code in the
boxes given.

Problem 1.
Incorrect Code:

var farm_land = createSprite(200, 200;


farmland.setAnimation("farm_land");
drawSprites()

Correct Code:

Problem 2.
Incorrect Code:

var windmill = createSprite(363,205);


Windmill.setAnimation("windmill");
windmill.scale 0.3;
drawSprites(;

Correct Code:

Problem 3.
Incorrect Code:

var cow = createSprite(285,285);


cow.setAnimation("cow);
Cow.scale = 0.2;
drawSprites()

Correct Code:
Problem 4.
Incorrect Code:

var tractor createSprite(100,250);


tractor.setAnimation(tractor");
Tractor.scale 0.2;
drawSprites();

Correct Code:

Problem 5.
Incorrect Code:

var Farmer = createSprite(150,260);


farmer.setAnimation("farmer")
farmeer.scale = 0.35;
drawSprites();

Correct Code:

Problem 6.
Correct Code:
textSize(14.4);
stroke("black");
strokeWeight(1.1);

Problem 7.
Incorrect Code:

fill(green");
text("I have extended the amount of farm land! , , 140, 150, 150);

Correct Code:
Problem 8.
Incorrect Code:

fill("purple);
text(Yay, that's really exciting! That means that I get to roam around more!",
225, 170, 150 ,300);

Correct Code:

Problem 9.
Incorrect Code:

textSize(35)
fill("blue);

Correct Code:

Problem 10.
Incorrect Code:

text(Rebels Farm!, 110, 50);

Correct Code:

Write a brief description of what the scene should look like when the code is
run properly:

You might also like