learn-co-curriculum / phase-0-javascript-events-acting-on-events-lab Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
https://learning.flatironschool.com/courses/6956/assignments/239271?module_item_id=562278
We do still have a problem, though. Even though we're only going one pixel at a time, eventually our dodger will zoom (well, relatively speaking) right out of view.
How can we prevent this? We need to check where the left edge of the dodger is and only move it if it hasn't yet reached the left edge of the game field.
We're doing essentially the same thing, but we first ensure that the dodger's left edge has not reached the left edge of its container.
Now try moving the dodger past the left edge. No can do!
Finally, implement the code needed to prevent the dodger from escaping off the right-hand side. How can we check whether the right edge of the dodger has reached the right edge of the game field? (Keep in mind that the dodger is 40px wide.)
RIGHT IS WORKING.
LEFT FAILS, When I cannot move it to the left of 0. But when I can, it passes.
TESTBED (npm test -> indexTest.js) IS WRONG. Somehow the test class is wrong and I didn't modify it. I commented the code:
//dodger.style.bottom = "0px";
//dodger.style.left = "0px";
THEN THE LEFT PASSED.
moveDodgerLeft()
1) moves the DODGER to the left
moveDodgerRight()
โ moves the DODGER to the right
1 passing (315ms)
1 failing
moveDodgerLeft()
moves the DODGER to the left:
AssertionError: expected +0 to be below +0
at Context. (test/indexTest.js:17:31)
at process.processImmediate (node:internal/timers:476:21)
Fix the test. Then regrade all of the assignments. I think the logic is just backwards for said test. Testbed fails when starting at the left corner.
diversify examples
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.