Answer:
var movie = {
name: "Avengers Endgame",
director: "Joe Russo",
composer: "Alan Silvestri",
cast: {
"Scarlett Johansson": "Black Widow",
"Chris Evans": "Captain America"
},
roleOf: function (name) {
if (typeof (this.cast[name]) !== 'undefined') {
return this.cast[name];
} else {
return "The actor is not part of this movie";
}
}
};
Explanation:
- Initialize the movie JSON (JavaScript Object Notation) having the name, director, composer and cast properties.
- Define a roleOf: function that has a name parameter.
- Check whether the selected is not equal to undefined and then return that name.
- Otherwise display this message: "The actor is not part of this movie".
Answer:
B: micro
Explanations
a small computer that contains a microprocessor as its central processor.
Without knowing the language, it's pretty imposible to write it. Once you start thinking recursively, it's not a difficult problem.
While you're recursing, pass the string without the first character.
The base case would be a null string which would return 0.
The unwind would just add one and return that.