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
Moving through a neighborhood trying to locate open wireless access points is called ________.
disa [49]
<span>Moving through a neighborhood trying to locate open wireless access points is called wardriving. 
</span> The action wardriving is performed by a person in a moving vehicle (car, bike..) who is using a laptop or smartphone and wants to catch a Wireless LAN (WiFi) network. For this purpose there is software <span>freely available on the Internet.</span>
7 0
3 years ago
Explain the changing of work and enterprises due to the availability of EFTPOS?
kolbaska11 [484]
Who benefits from piracy?



5 0
3 years ago
6.An organization wants to implement a remote dial-in server to ensure that personnel can connect to the organization's network
Sauron [17]

Answer:

Challenge-Handshake Authentication Protocol (CHAP).

Explanation:

In Computer technology, authentication can be defined as the process of verifying the identity of an individual or electronic device. Authentication work based on the principle (framework) of matching an incoming request from a user or electronic device to a set of uniquely defined credentials.

Basically, authentication ensures a user is truly who he or she claims to be, as well as confirm that an electronic device is valid through the process of verification.

In this scenario, an organization wants to implement a remote dial-in server to ensure that personnel can connect to the organization's network from remote locations. The authentication protocol must include encryption to prevent hackers from accessing the network.

Hence, the protocol which should be used is Challenge-Handshake Authentication Protocol (CHAP).

A Challenge-Handshake Authentication Protocol (CHAP) can be defined as a standard network access control protocol in which a client program dials in to a network access server to receive a random value and identification number that can only be used once.

5 0
3 years ago
Que es el internet...
grigory [225]

Answer:

una red informática mundial que proporciona una variedad de instalaciones de información y comunicación, que consta de redes interconectadas que utilizan protocolos de comunicación estandarizados.

3 0
3 years ago
Why isn't brainly working everytime it doesn't allow me to view the answer when I click see answers.
Andreas93 [3]

Answer:

maybe because you did not sign up and do the trial so you probably cant see answers anymore.

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • A computer connected to the internet that asks for data is a ________. aggregator surrogate server client
    6·1 answer
  • Which of the statements below explains why a budget is useful
    10·1 answer
  • Namespaces cannot have namespaces as members.<br><br> True<br><br> False
    7·1 answer
  • Which of the following is considered both an input and output peripheral?
    10·1 answer
  • What device is used to transmit what is effectively a type of Morse code between stations?
    11·1 answer
  • What do you need for digital photography? 1. 2. 3.
    13·1 answer
  • What is modularity? Help asap
    9·1 answer
  • Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.
    15·1 answer
  • In a spreadsheet what does the following symbol mean?<br><br> $
    10·1 answer
  • Designations at the end of file names such as .docx and .html are called
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!