app.js
/*
 * Method that displays the name(planet identifier) of the planet orbiting the hottest star.
 * Here we use `map and filter methods` to iterate the array of exoPlanetDataSet objects and get the name of Planet Identifier using maximum HostStarTempK.
 * {Arguments}
 * exoPlanetDataSet : array of exoPlanet objects.
 * displays and returns the name(planet identifier) of the planet orbiting the hottest star.
 */
Method that displays the name(planet identifier) of the planet orbiting the hottest star.
Here we use `map and filter methods` to iterate the array of exoPlanetDataSet objects and get the name of Planet Identifier using maximum HostStarTempK.
{Arguments}
exoPlanetDataSet : array of exoPlanet objects.
displays and returns the name(planet identifier) of the planet orbiting the hottest star.
Method that displays the name ( planet identifier ) of the planet orbiting the hottest star . Here we use ` map and filter methods ` to iterate the array of exoPlanetDataSet objects and get the name of Planet Identifier using maximum HostStarTempK . { Arguments } exoPlanetDataSet : array of exoPlanet objects . displays and returns the name ( planet identifier ) of the planet orbiting the hottest star .
function displayHottestStar(exoPlanetDataSet) {
	if (exoPlanetDataSet && exoPlanetDataSet.length > 0) {
		var maximumTempK = Math.max.apply(null, Object.keys(exoPlanetDataSet).map(function (x) { return exoPlanetDataSet[x].HostStarTempK }));
		const exoPlanetDataSetIndex = (Object.keys(exoPlanetDataSet).filter(function (x) { return exoPlanetDataSet[x].HostStarTempK == maximumTempK; })[0]);
		console.log('The name (planet identifier) of the planet orbiting the hottest star: ', exoPlanetDataSet[exoPlanetDataSetIndex].PlanetIdentifier);
		return exoPlanetDataSet[exoPlanetDataSetIndex].PlanetIdentifier; 
	}
	return "";
}
function displayHottestStar ( exoPlanetDataSet ) { if ( exoPlanetDataSet && exoPlanetDataSet . length > 0 ) { var maximumTempK = Math . max . apply ( null , Object . keys ( exoPlanetDataSet ) . map ( function ( x ) { return exoPlanetDataSet [ x ] . HostStarTempK } ) ) ; const exoPlanetDataSetIndex = ( Object . keys ( exoPlanetDataSet ) . filter ( function ( x ) { return exoPlanetDataSet [ x ] . HostStarTempK == maximumTempK ; } ) [ 0 ] ) ; console . log ( 'The name (planet identifier) of the planet orbiting the hottest star: ' , exoPlanetDataSet [ exoPlanetDataSetIndex ] . PlanetIdentifier ) ; return exoPlanetDataSet [ exoPlanetDataSetIndex ] . PlanetIdentifier ; } return "" ; }
Method that displays the name(planet identifier) of the planet orbiting the hottest star.
Method that displays the name ( planet identifier ) of the planet orbiting the hottest star .
// Iterate the array of exoPlanetDataSet objects to get the maximum value of HostStarTempK // filter the exoPlanetDataSet object to get the index of the object which have the maximum HostStarTempK //return the name(planet identifier) of the planet orbiting the hottest star