Code - Javascript
/* object array */
var data = [
{
"name": "Jack",
"mobile": "1234",
"date": "2019-01-15 13:42:11"
},
{
"name": "Jack",
"mobile": "1234",
"date": "2019-01-13 10:35:55"
},
{
"name": "Jack",
"mobile": "1234",
"date": "2019-01-13 9:20:55"
},
{
"name": "Mike",
"mobile": "1234",
"date": "2019-01-13 12:35:55"
},
{
"name": "Mike",
"mobile": "1234",
"date": " 2019-01-13 9:30:55"
},
{
"name": "Mike",
"mobile": "1234",
"date": "2019-01-13 05:25:55"
}]
/* function call filterArray */
filterArray(data);
/* it take json object as arguement */
function filterArray(data) {
let maxDate;
/* get the max date of Jack uding filter and reduce fucntion javascript*/
maxDateJack = data.filter((d) => d.name === "Jack").
reduce((acc, prev) => {
if (new Date(acc.date) > new Date(prev.date)) {
maxDate = acc.date;
}
return maxDate;
})
console.log(maxDateJack)
let maxDateMike;
/* get the max date of Mike */
maxDateMike = data.filter((d) => d.name === "Mike").
reduce((acc, prev) => {
if (new Date(acc.date) > new Date(prev.date)) {
maxDateMike = acc.date;
}
return maxDateMike;
})
console.log(maxDateMike)
/* get the max date of Jack and Mike using filter*/
filterDate = data.filter((d) => {
if (d.date == maxDateJack || d.date == maxDateMike) {
return d;
}
})
console.log(filterDate)
return filterDate;
}
suppose i have an array in Javascript with several objects in it. var data = [...
QUESTION 35
When you've created a
data structure like this ____.
var rect = {length: 9,
width: 6};
you have created a
direct instance of an object
you have created an
object using a custom constructor function
you have created an
object literal
you have created an
array literal
QUESTION 38
"Once a web page has finished loading, then the ____ event
handler fires."
loaded
onload
complete
done
the language using in javascript
QUESTION 29 You have this form. Assume...
An array of class objects is similar to an array of some other data type. To create an array of Points, we write Point parray [4]; To access the object at position i of the array, we write parray [i] and to call a method on that object method, we write parray [i]. methodName (arg1 , arg2 , ...) ; To initialize an array of objects whose values are known at compile time, we can write Point parray [4] =...
javascript questions
Declare an empty deck array. Use a loop to fill the array with
string values that represent the 52 cards of a normal deck. The
numbers go from 1 to 13 with 1 for an ace, 11 for a jack, 12 for a
queen, and 13 for a king. The suits are C for clubs, D for
diamonds, H for hearts, and S for spades. Here’s the list of 52
values:
1C, …, 13C, 1D, …, 13D, 1H,...
LAB 4: JavaScript Loops Part I) 1) Make an array of colors, instead of responses, call it colors. Color names go inside quotes, i.e. "red". 2) Copy the line of the var randomNum, but instead of looking at the length of responses, look at the length of your colors array. 3) Declare a variable myColor below the randomNum variable declaration. 4) Save a randomly chosen color into the variable myColor. colors[randomNum] picks a random color from the array. Save...
Need help with C++ assignment
Assignment 1 and .txt files are provided at the
bottom.
PART A
PART B
Assignment
1
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <algorithm>
using namespace std;
/**
This structure is to store the date and it has three integer
fields
**/
struct Date{
int day;
int month;
int year;
};
/**
This structure is to store the size of the box and it...
In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list of objects. Also, this lab specification tells you only what to do, you now have more responsibility to design how to do it. Problem description You are given a text file called 'Students.txt' that contains information on many students. Your program reads the file, creating many Student objects, all of which will be stored into an array list of Student objects, in the Students...
i need help with this experiment, i have the rawa data and
equation.
Objects crucible cover Magnesium mass (g) 20.5436 2.3947 0.4126 After 2nd heating object magnesium oxide mass (g) 0.4846 After 3rd heating object magnesium oxide mass (g) 0.5426 After 4th heating object magnesium oxide mass (g) 0.5716 M ..1 Metro by T-Mobile 6:17 AM Aa to Q 66 Experiment 6 The Law of Definite Proportions Reaction (6.1) will take place when a weighed, fixed amount of Mg(s) is...
Java Programming Create a program named MovieTest The program will create 10 Movie objects and place them in an array or ArrayList of type Movie. The program must do the following (all in main): Create an array or ArrayList of type Movie. Use the data in the text file that is in the download for the Movie file to create 10 Movie objects. Store the 10 Movie objects in the array or ArrayList. You MUST use the date in the...
I cant complete this assignment, I have tried several ways shown in the tutorial but cant seem to get it to validate, can anyone help? This is a basic JavaScript tutorial and will not validate with Jquery. Monroe Public Library Denise Kruschev manages the website for the Monroe Public Library in Monroe, Ohio. One of her responsibilities is to add content and links to the site that will be of interest to the library’s patrons. Denise has asked you to...
The file containing the JAVA files, pseudocode file and doc file
that have written for this lab.
Preamble The file releasedates.txt contains a list of video games and their release dates. Each line of the file contains the release date, a tab character, and then the name. The list is currently totally unsorted. The object of today's lab is to write a series of methods that allow us to perform the following tasks: read contents from a file and store...