Premium Features

Download Video

More Accurate Object Removal

Published 5 months ago

Currently to remove objects from our game we loop through the front of our array, then call a splice method. Although this'll work when we use in pairing with setTimeout, it will cause issues later on once our game gets more complex and requires more resources. As a result, here we will refactor any forEach loop, that also uses splice, to loop through its contents starting from the back of the array.


Want to participate?

Create a free Chris Courses account to begin


No comments yet, be the first to add one

Cheat Sheet Preview

Download The Official Chris Courses HTML5 Canvas Cheat Sheet

Essential canvas syntax at your fingertips.

Download Now

Providing the lift to launch your development career

© 2022 Chris Courses. All rights reserved.