- Fork and clone this repo.
- Create a file to work in.
- Follow the tasks below.
- Use
node
to test your work.
Given the array of transformers below, acomplish the following tasks:
- Write a function called
transformersNames
that usesmap
to return a new array of transformers' names. - Write a function called
onlyAutobots
that usesfilter
to return a new array of only Autobots. - Write a function called
onlyVehicles
that usesfilter
to return a new array of transformers with only vehicle forms.
var transformers = [
{
name: 'Optimus Prime',
form: 'Freightliner Truck',
form_type: 'vehicle',
team: 'Autobot'
},
{
name: 'Megatron',
form: 'Gun',
form_type: 'object',
team: 'Decepticon'
},
{
name: 'Bumblebee',
form: 'VW Beetle',
form_type: 'vehicle',
team: 'Autobot'
},
{
name: 'Soundwave',
form: 'Walkman',
form_type: 'object',
team: 'Decepticon'
},
{
name: 'Starscream',
form: 'Fighter Jet',
form_type: 'vehicle',
team: 'Decepticon',
},
{
name: 'Rodimus Prime',
form: 'Ford GT',
form_type: 'vehicle',
team: 'Autobot',
}
];
In DNA strings, symbols "A" and "T" are complements of each other, as are "C" and "G". Write a function called dnaTransform that takes in a DNA string returns a string that represents it's compliment. For example: dnaTransform("ATTGC")
will rerurn "TAACG"
Reduce the array of constructions below to form Devastator!
The Devastator object should look like this:
{
name: 'Devastator',
team: 'Decepticons',
form: {
rightLeg: 'Scrapper',
upperTorso: 'Hook',
leftArm: 'Bonecrusher',
rightArm: 'Scavenger',
leftLeg: 'Mixmaster',
lowerTorso: 'Long Haul',
},
}
var constructicons = [
{
name: 'Scrapper',
form: 'Freightliner Truck',
team: 'Decepticon',
bodyPart: 'rightLeg'
},
{
name: 'Hook',
form: 'Mobile Crane',
team: 'Decepticon',
bodyPart: 'upperTorso'
},
{
name: 'Bonecrusher',
form: 'Bulldozer',
team: 'Decepticon',
bodyPart: 'leftArm'
},
{
name: 'Scavenger',
form: 'Excavator',
team: 'Decepticon',
bodyPart: 'rightArm'
},
{
name: 'Mixmaster',
form: 'Concrete Mixer',
team: 'Decepticon',
bodyPart: 'leftLeg'
},
{
name: 'Long Haul',
form: 'Dump Truck',
team: 'Decepticon',
bodyPart: 'lowerTorso'
}
];