Skip to content

Instantly share code, notes, and snippets.

@brittanydionigi
Last active September 15, 2018 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brittanydionigi/ae2998888d082880ee61cc69baf6da40 to your computer and use it in GitHub Desktop.
Save brittanydionigi/ae2998888d082880ee61cc69baf6da40 to your computer and use it in GitHub Desktop.
const constellations = {
orion: {
names: ['Orion', 'The Hunter', 'The Giant', 'The Deer'],
stars: ['Betelgeuse', 'Rigel', 'Bellatrix', 'Mintaka', 'Alnilam', 'Alnitak', 'Saiph']
},
ursaMajor: {
names: ['Ursa Major', 'The Big Dipper', 'The Great Bear', 'The Plow'],
stars: ['Dubhe', 'Merak', 'Phecda', 'Megrez', 'Alioth', 'Mizar', 'Alkaid']
},
ursaMinor: {
names: ['Ursa Minor', 'The Little Dipper', 'The Cub', 'The Little Bear'],
stars: ['Polaris', 'Kochab', 'Pherkad', 'Delta', 'Epsilon Ursae Minoris', 'Lambda Ursae Minoris']
}
};
const brightestStars = [
{
name: 'Sirius',
visualMagnitude: -1.46,
constellation: 'Canis Major',
lightYearsFromEarth: 8.6,
color: 'blue'
},
{
name: 'Canopis',
visualMagnitude: -0.74,
constellation: 'Carina',
lightYearsFromEarth: 310,
color: 'white'
},
{
name: 'Alpha Centauri',
visualMagnitude: -0.27,
constellation: '',
lightYearsFromEarth: 4.4,
color: 'yellow'
},
{
name: 'Arcturus',
visualMagnitude: -0.05,
constellation: 'Boötes',
lightYearsFromEarth: 37,
color: 'orange'
},
{
name: 'Vega',
visualMagnitude: 0.3,
constellation: 'Lyra',
lightYearsFromEarth: 25,
color: 'blue'
},
{
name: 'Capella',
visualMagnitude: 0.08,
constellation: 'Auriga',
lightYearsFromEarth: 42,
color: 'yellow'
},
{
name: 'Rigel',
visualMagnitude: 0.13,
constellation: 'Orion',
lightYearsFromEarth: 860,
color: 'blue'
},
{
name: 'Procyon',
visualMagnitude: 0.34,
constellation: 'Canis Minor',
lightYearsFromEarth: 11,
color: 'white'
},
{
name: 'Achernar',
visualMagnitude: 0.46,
constellation: 'The Plow',
lightYearsFromEarth: 140,
color: 'blue'
},
{
name: 'Betelgeuse',
visualMagnitude: 0.5,
constellation: 'Orion',
lightYearsFromEarth: 640,
color: 'red'
},
{
name: 'Hadar',
visualMagnitude: 0.61,
constellation: 'The Little Dipper',
lightYearsFromEarth: 350,
color: 'blue'
}
];
// Prompt #1 - Return an array of all the brightest stars that appear in any of the constellations listed in the constellations object.
// e.g.
// [
// { name: 'Rigel',
// visualMagnitude: 0.13,
// constellation: 'Orion',
// lightYearsFromEarth: 860,
// color: 'blue' },
// { name: 'Betelgeuse',
// visualMagnitude: 0.5,
// constellation: 'Orion',
// lightYearsFromEarth: 640,
// color: 'red' }
// ]
// Prompt #2 Return an array of the names of the constellations that the brightest stars are part of
// [ 'Canis Major',
// 'Carina',
// 'Boötes',
// 'Lyra',
// 'Auriga',
// 'Orion',
// 'Canis Minor',
// 'Eridanus',
// 'Orion',
// 'Centaurus' ]
// Prompt #3 Return an object with keys of the different colors of the brightest stars, whose values are arrays containing the star objects that match
// {
// blue: [{obj}, {obj}, {obj}, {obj}, {obj}],
// white: [{obj}, {obj}],
// yellow: [{obj}, {obj}],
// orange: [{obj}],
// red: [{obj}]
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment