Question: answer ASAP plz. i will rate. need the code in JAVASCRIPT. USE THE FOLLOWING FUNCTION HEADER ONLY PLZ! picture of the required function header also






Create unique device names to be used in a residential loT (Internet of Things) system. If a device name already exists in the system, an integer number is added at the end of the name to make it unique. The integer[added starts with 1 and is incremented by 1 for each new request of an existing device name. Given a list of device name requests, process all requests and return an array of the corresponding unique device names. Example n = 6 devicenames = ['switch' , 'tv, 'switch', 'tv', 'switch', 'tv'] devicenames[0] = "switch" is unique. uniqueDevicename[0]="switch" . . devicenames[0] - "switch" is unique. uniqueDevicename[0]="switch" devicenames[1] = "t" is unique. uniqueDevicename[1]="TV" devicenames[2)=devicenames[0]. Add 1 at the end the previous unique username "switch". uniqueDevicename[2]="switch1" devicenames[3) = devicenames(1). Add .1 at the end the previous unique username "t". W uniqueDevicename[3) "tv1" devicenames[4] =devicenames[2]. Increment by 1 the number at the end of the previous unique username "switch1", unique Devicenames[4]="switch2" devicenames(5) = devicenames[3). Increment by 1 the number at the end of the previous unique username "t1" unique Devicenames[5]="tV2" return uniqueDevicenames = ['switch tv switch tv1 'switch2, tv2] . . Function Description Function Description Complete the function deviceNamesSystem in the editor below. deviceNamesSystem has the following parameter(s); string devicenames[di: an array of device name strings in the order requested. Returns string[n): an array of string usernames in the order assigned Constraints . 15 ns104 1 s length of devicenames[i]* 20 devicenames[i] contains only lowercase English letters in the range ascii[a-z]. Input Format for Custom Testing Sample Case 0 Constraints 13n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
