Computer Org & Systems Comp 306 - Microsoft Azure
Computer Org & Systems Comp 306
Lab 2 22 Sept 2020
Due: Tuesday, 29 September, beginning of class.
Name:
Objectives
? Be able to use built-in array methods to manipulate array elements ? Be able to de-structure arrays in JavaScript
1 Array Methods
Write JavaScript code that performs the following actions. All functions must be created using arrow syntax.
? Create an array that is populated with 50 random numbers with values between 100 and 200 (see random.asp for generating random numbers in JavaScript).
? Print all numbers less than 150 using the filter array method.
? Print all the numbers, but each number must be multiplied by 10. Use the map function and a function that you create to perform this task.
? Print the sum of the numbers. Before you add any number into the sum, however, subtract 2 from it. Use reduce and a function that you create to perform this task.
? Now combine all three actions above into one JavaScript statement with each array method using the result of the previous method. You should print all numbers less than 150, each multiplied by 10 and then summed (but before adding an element, subtract 2 from it).
2 Array methods and objects
? Create a student object with three properties, a name, a gpa and an address. The address must itself be an object with a street, city, and state. Use a constructor function for this. You do not have to instantiate the object at this time, just create the constructor function.
1
? . Next write a function that creates and returns an array of 10 student objects. ? Create a function that takes the array of student objects and uses the filter array method
to create an array of students with a gpa of 3.0 or greater. Then print these. ? Create a function that takes the array of student objects and uses the reduce array method
to get the sum of the gpa's. The print the average gpa. ? Create a function that takes the array of student objects and uses the filter and reduce
array methods to get the sum of student gpa's for all gpa's greater than 3.0. Then print the average gpa for these students.
3 Submission
1. Save your JavaScript in a text file named YourLastName.js. Make sure that you have a comment at the top of the file with your name, the lab number, and the date last modified.
2. Upload your file to Sakai.
2
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- javascript arrays object
- javascript and browser objects quick reference javascript
- functional and object oriented javascript
- javascript programming stanford university
- 1 2 https 2343eo
- computer org systems comp 306 microsoft azure
- javascript jquery and ajax
- javascript data wrangling cheat sheet
- jquery beyond javascript
Related searches
- computer information systems definition
- microsoft azure revenue
- computer information systems degree salary
- computer information systems degree description
- computer information systems degree
- computer information systems salary
- computer information systems jobs list
- computer information systems job description
- computer information systems career list
- computer information systems jobs description
- computer networks systems approach pdf
- computer operating systems ppt