1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jarptica [38.1K]
2 years ago
15

Define a method named orderOfAppearance() that takes the name of a role as an argument and returns that role's order of appearan

ce. If the role is not found, the method returns 0. Ex: orderOfAppearance("Forrest Gump") returns 1. Hint: A method may access the object's properties using the keyword this. Ex: this.title accesses the object's title property.
// Code will be tested with different roles and movies
let movie = {
title: "Forrest Gump",
director: "Robert Zemeckis",
composer: "Alan Silvestri",
roles: [ // Roles are stored in order of appearance
"Forrest Gump",
"Young Forrest Gump",
"Jenny Curran",
"Lieutenant Dan Taylor"
],
orderOfAppearance: function(role) {

}
};
Computers and Technology
1 answer:
ioda2 years ago
6 0

The method named orderOfAppearance() that takes the name of a role as an argument is; Written as below

<h3>How to write a Program in Java?</h3>

The steps to write this Java program is as follows;

  • 1) Initialize the movie JSON (JavaScript Object Notation) having the name, director, composer and title properties.
  • 2) Define a roleOf: function that has a name parameter.
  • 3) Check whether the selected is not equal to undefined and then return that name.
  • 4) Otherwise display this message: "0".

let movie = {

  name: "Forrest Gump",

  director: "Robert Zemeckis",

  composer: "Alan Silvestri",

  title: {

      "Forrest Gump",

      "Young Forrest Gump"

      "Jenny Curran"  

       "Lieutenant Dan Taylor"            

  },

  orderOfAppearance: function (role) {

      if (typeof (this.title[role]) !== 'undefined') {

          return this.title[role];

      } else {

          return "0";

      }

  }

};

Read more about java programming at; brainly.com/question/16397886

You might be interested in
Entering the formula =sum(c5:c18) in cell c19 will result in which of the following?
antiseptic1488 [7]
If you mean Excel formula sum(c5:c18) in cell c19 will show <span>c. the total of cells c5 to c18 will appear in cell c19. It's simple operation that simplyfies counting different values.</span>
5 0
3 years ago
Why we need to measure the amperage of an electric current?​
Romashka [77]

Answer:

Explanation:It is very important to have a way to measure and quantify the flow of electrical current. When current flow is controlled it can be used to do useful work. The flow of electrons is measured in units called amperes. The term amps is often used for short

5 0
3 years ago
I need help pls, in this code if add row for example :
tankabanditka [31]
I thing is going project experiment everyone make plans and
3 0
4 years ago
Which term refers to computer programs that provide computer users with a graphical interface to the internet?
bulgar [2K]
Web browser is the term that refers to computer program that provide computer users with graphical interface to the internet.
4 0
3 years ago
A computer uses a memory unit with 256k words of 32 bits each. A bina.ry
iogann1982 [59]

Answer:

Touch and hold a clip to pin it. Unpinned clips will be deleted after 1 hour.

4 0
3 years ago
Other questions:
  • Explain why computer users should use the cloud?
    14·1 answer
  • Productivity can best be described as:
    5·2 answers
  • Given that Marcy worked 42 hours (Hours = 42) last week and earns $10.00 an hour (Rate = 10), how much did Marcy earn last week,
    12·1 answer
  • Write a Program in C language using arrays:
    14·1 answer
  • The letters a, e, i, o and u are the only vowels. Write a function named vowelUseDict() takes a string t as a parameter and comp
    7·1 answer
  • 1. Write a CFG to generate identifiers (IDs) in the Java Programming Language. An ID in Java is a string of characters consistin
    5·1 answer
  • LAST TIME ASKING FOR APPS THAT ARE FREE THAT I DONT NEED TO PAY THE APPS HAVE TO HELP ME STOP VIRUSES FROM MY PHONE PLZ HELP THE
    6·2 answers
  • Write a C++ program to calculate the course score of CSC 126. 1. A student can enter scores of 3 quizzes, 2 exams, and a final e
    9·1 answer
  • Write a function named parts that will take in as parameters the dimensions of the box (length, width, and height) and the radiu
    12·1 answer
  • The agency that started ARPANET was looking for
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!