MEADOWBROOK P5JS
  • Fifth Grade Math Class
    • First Project
    • Openprocessing
    • Email from Weds
    • Practice
  • Tutorials
    • P5JS Intro >
      • Intro HW
    • Shapes >
      • Processing Hour of Code Poster
      • House
      • Shapes HW >
        • Shaded Triangles
    • Color >
      • Color and Shapes Review
      • Color HW
    • Arcs >
      • Introduction to Arcs
      • Thurs Arcs Homework
      • Four Shapes
      • Fri. Homework
      • 11.37 Two Arcs in Rectangle
    • Moving with the Mouse >
      • Shaded Arcs
      • Moving Mouse HW
    • Variables >
      • Draw Proportional Face >
        • Code for Head with Eyes
      • Pet Goat >
        • Pet Goat Solution Image
    • Distance >
      • Mouse inside a Circle
    • Map Command
    • Conditional Statements >
      • Detecting an Edge
      • Else Statement
      • Boolean Variables
    • Rotate, Translate, Push, Pop >
      • Scale
      • More on Push and Pop
    • Repeat Loops >
      • Nested Loops
    • Define Your Own Functions >
      • Functions
      • Functions and Return
    • Object Oriented Classes
    • Arrays >
      • Arrays and Loops
      • Arrays of Objects
      • Constructor Objects
      • Adding and Removing Objects in an Array
      • Clicking on Objects
  • Fifth Grade Math Class
    • First Project
    • Openprocessing
    • Email from Weds
    • Practice
  • Tutorials
    • P5JS Intro >
      • Intro HW
    • Shapes >
      • Processing Hour of Code Poster
      • House
      • Shapes HW >
        • Shaded Triangles
    • Color >
      • Color and Shapes Review
      • Color HW
    • Arcs >
      • Introduction to Arcs
      • Thurs Arcs Homework
      • Four Shapes
      • Fri. Homework
      • 11.37 Two Arcs in Rectangle
    • Moving with the Mouse >
      • Shaded Arcs
      • Moving Mouse HW
    • Variables >
      • Draw Proportional Face >
        • Code for Head with Eyes
      • Pet Goat >
        • Pet Goat Solution Image
    • Distance >
      • Mouse inside a Circle
    • Map Command
    • Conditional Statements >
      • Detecting an Edge
      • Else Statement
      • Boolean Variables
    • Rotate, Translate, Push, Pop >
      • Scale
      • More on Push and Pop
    • Repeat Loops >
      • Nested Loops
    • Define Your Own Functions >
      • Functions
      • Functions and Return
    • Object Oriented Classes
    • Arrays >
      • Arrays and Loops
      • Arrays of Objects
      • Constructor Objects
      • Adding and Removing Objects in an Array
      • Clicking on Objects
Search by typing & pressing enter

YOUR CART

Adding and removing objects to an array

7.5: Adding and Removing Objects - p5.js Tutorial
Code for this tutorial

Removing Objects from an Array

Pop = takes last item off the end of the array (Last in, first out)

Find out what other commands are in Javascript.

Push = appends a value to the end of the array; extends the size of the array by 1.
Splice(index, how many)  = allows you to take stuff out of the array. Index = first item to delete.

When deleting elements from an array, be sure to change your for() command to start at the end of your array and go backwards, down to 0.
Powered by Create your own unique website with customizable templates.