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
IRINA_888 [86]
3 years ago
5

Write a function searchBooks which returns ALL the books written by a specific author and return the list of the book titles as

a string, separated with comma if there are more than one titles. If these is no author in the library then return 'NOT FOUND'. Example dataset: library = [ { author: 'Bill Gates', title: 'The Road Ahead', libraryID: 1254} ];.
Computers and Technology
1 answer:
dalvyx [7]3 years ago
4 0

Answer:

var library=[{author:'Bill Gates',title:'The Road Ahead',libraryID:1254},

              {author:'Abdul Kalam',title:'India 2020',libraryID:1243},

              {author:'Abdul Kalam',title:'Ignited Minds',libraryID:1200},

              {author:'Abdul Kalam',title:'Inspiring thoughts',libraryID:1200},

              {author:'Aristotle',title:'Metaphysics',libraryID:1200}

              ];

  //author of the book to be searched

  var authorName='Abdul Kalam';

  //document.write() will write in the html page

  a=searchBooks(library,authorName);

  books=a[0];

  authorNames=a[1];

  //<h1></h1> is used to make heading Books

  document.write("Books:\n");

  for(i=0;i<books.length;i++)

      document.write(books[i]['author']+" --> "+books[i]['title']+" --> "+books[i]['libraryID']+"<br>");

  document.write("Titles:\n"+a[1]);

  function searchBooks(library,authorName){

      //empty string to assign book names

      list_of_titles='';

      books=[];

      //reading each book from 0th position to last

      for(i=0;i<library.length;i++){

          //if author is authorName then add it to list_of_titles

          if(library[i]['author']==authorName){

              books.push(library[i]);

              list_of_titles+=library[i]['title']+",";

          }

      }

      //removing the last comma

      list_of_titles=list_of_titles.slice(0,-1);

      //if list_of_titles is empty return NOTFOUND

      if(list_of_titles=='')

          return 'NOT FOUND';

      //if books are found return list_of_titles

      else

          return [books,list_of_titles];

      //returning the list of books and titles

  }

You might be interested in
Trudy is preparing a reply to an email message. Before she could send out the message, she is called for a meeting. If Trudy has
Ronch [10]
Her Drafts folder. Hope this helped!
3 0
3 years ago
Read 2 more answers
How many base cases are in the functionabove?
baherus [9]

Answer:

The answer is (b). 1.

Explanation:

In the code there is only 1 base case .

the base case is as following:-

if(n==0)

return 0;

this is the base case.

Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.

5 0
3 years ago
Which of the following areas of study have been instrumental in shaping the development of HCT?
Ivan

Answer:

Cognitive Science and Graphic Design.

and hence D and E options are correct.

Explanation:

By HCT we mean Home and Community-based Treatment. This is, in fact, a home-based behavioral health-related service for the young people and all families which seek a better treatment plan, that is more advanced apart from an emergency therapy. And as far as the HCT's are concerned, they have well trained in quite a good number of treatment procedures like Cognitive Science related procedures. trauma centric cognitive treatment. However, a little bit of Arts and creativity is also required, and hence, you should know about the graphic design also.

8 0
4 years ago
Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system?
never [62]

Answer:

The answer is "Option c".

Explanation:

Computer simulation, use of a machine to simulate a system's vibration signals by another modeled system's behaviors. A simulator employs a computer program to generate a mathematical model or representation of a true system. It usually gives a lot of simplifications concerning the physical image or system that is modeled, so this statement describes the limitation of using a computer simulation in modeling a real-world object or process.

5 0
3 years ago
4.<br>d)<br>2 X 4<br>272 253<br>X Х<br>32 59<br>Х<br>3​
lawyer [7]

Answer:

idk what we are multipyling

Explanation:

please write out clearly so I can solve

6 0
3 years ago
Other questions:
  • What happened to Henry at the end of Chapter 4 in Bendy and the ink machine?
    9·2 answers
  • Write down the complete procedure for creating ExcelSheet.
    8·1 answer
  • The shortcut key to access the spelling and grammar check is _____.
    11·2 answers
  • When nat hides the source ip of an originating device, this is known as ________?
    15·2 answers
  • Which access modifier is not allowed in a struct? Private Public Protected Internal All of the Above None of the Above A block {
    11·1 answer
  • Does anyone know how to connect a nintendo switch to a laptop?
    10·2 answers
  • 6. Assume there are three small caches, each consisting of four one-word blocks. One cache is fully associative, a second is two
    5·1 answer
  • _ is a term used for license like those issues by creative commons license as an alternative to copyright
    8·1 answer
  • What is Mobile Edge Computing? Explain in tagalog.​
    5·2 answers
  • Which option is designed by software engineers?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!