You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
//Important Note: Do not change the variable names.
|
|
//All required classes, variables and function names are listed in the exports.
|
|
|
|
// Exponent Operator
|
|
|
|
// Template Literals
|
|
|
|
// Array Destructuring
|
|
const address = ["258", "Washington Ave NW", "California", "90011"];
|
|
|
|
// Object Destructuring
|
|
const animal = {
|
|
name: "Lolong",
|
|
species: "saltwater crocodile",
|
|
weight: "1075 kgs",
|
|
measurement: "20 ft 3 in"
|
|
}
|
|
|
|
|
|
// Arrow Functions
|
|
let numbers = [1, 2, 3, 4, 5];
|
|
|
|
// Javascript Classes
|
|
|
|
|
|
|
|
//Do not modify
|
|
//For exporting to test.js
|
|
//Note: Do not change any variable and function names. All variables and functions to be checked are listed in the exports.
|
|
try{
|
|
module.exports = {
|
|
|
|
getCube: typeof getCube !== 'undefined' ? getCube : null,
|
|
houseNumber: typeof houseNumber !== 'undefined' ? houseNumber : null,
|
|
street: typeof street !== 'undefined' ? street : null,
|
|
state: typeof state !== 'undefined' ? state : null,
|
|
zipCode: typeof zipCode !== 'undefined' ? zipCode : null,
|
|
name: typeof name !== 'undefined' ? name : null,
|
|
species: typeof species !== 'undefined' ? species : null,
|
|
weight: typeof weight !== 'undefined' ? weight : null,
|
|
measurement: typeof measurement !== 'undefined' ? measurement : null,
|
|
reduceNumber: typeof reduceNumber !== 'undefined' ? reduceNumber : null,
|
|
Dog: typeof Dog !== 'undefined' ? Dog : null
|
|
|
|
}
|
|
} catch(err){
|
|
|
|
}
|
|
|
|
|
|
|
|
numbers.forEach(numbers => {
|
|
console.log (` ${numbers}`);
|
|
|
|
});
|
|
const reduceNumber = numbers.reduce((accumulator, currentValue) =>
|
|
accumulator + currentValue, 0);
|
|
|
|
|
|
|
|
|
|
console.log(reduceNumber); // Output: 15
|
|
|
|
|
|
|