Question
Using HTML/JavaScript Creating Arrays: Create and empty array named sabio.page.empty. Console log the length of the array. Create an array named sabio.page.myNumbers which: Must contain
Using HTML/JavaScript
Creating Arrays:
Create and empty array named sabio.page.empty. Console log the length of the array.
Create an array named sabio.page.myNumbers which:
Must contain at least 4 members
All of them should be numbers
Accesing an Array Element:
Given the array sabio.page.pets = ['Fido', 'Chucho', 'Rocky', 'Drago','Precious'];
Console log the length of the array.
Console log the value of the element of index 1 of the array
Console log the value of the element of index 3 of the array
Adding an Array Element:
Given the array sabio.page.colors = ['Red', 'White', 'Black', 'Blue']; Use push() orunshift() to:
Add the color Yellow to the end of the sabio.page.colors array.
Add the color Green to the beginning of the sabio.page.colors array.
Combining Arrays:
Create a function named sabio.page.combine that will accept two arrays and combine both arrays.
Removing elements from an Array
Create a function named sabio.page.removeFirst that will accept an array. It should remove the first item from the array and return the item that was just removed. Use the shift() method to accomplish this.
Create a function named sabio.page.removeLast that will accept an array. It should remove the last item from the array and return the item that was just removed. Use the pop() method to accomplish this.
Create a function named sabio.page.removeThird that will accept an array. It should remove the element in the third index of the array and return the current arraywithout this element. Use the splice() method to accomplish this.
Array Enumeration
Create a function named sabio.page.calledInLoop that will accept one parameter and the function should console log the parameter.
Create a function named sabio.page.loopThrough that will accept an array.
Loop through each member of the array and invoke the function sabio.page.calledInLoop.
The result should be each element of the array console logged.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started