I have an error inside my simple javascript code, I want you to fix it. The code is simple. The code is supposed to print an array with 10 elements, but when it comes to one element inside the array, it is supposed to concatenate a string value
The problem with my code is it is printing all elements of the array, but it is not concatenating a string to one element. The problem is inside my print_array_changed function
Generally, the code is required to print all elements with one element having a concatenated string. Look inside the print_array_changed function and fix it to attain the desired goal
Code
Since the case mismatches the output produced is wrong. So the idea is to make both the string to lowercase compare it if equals then print.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
- I want this work be done in C# Visual studio. Given the following: private void btnRun_Click(object sender, EventArgs e){//Your code goes here } Code the statement(s) that will create a integer array of 5 elements and initialize the array with the following values in one line of code 10, 15, 20, 25, and 30. Then using a for loop alter the values in each element of the array by adding 5 to it. So after the for loop runs the values of the array should be 15, 20, 25, 30, and 35.arrow_forwardRewrite your most recent high scores program so that each name/score pair is stored in a struct named Highscore. Except as noted below, this new program will continue to meet all of the requirements of your most recent high scores program. Your new program should meet the following additional requirements: The Highscore struct should have two fields: an int named score and a char array named name. The char array should have 24 elements, making the maximum length of the name 23. The data should be stored in a single array, a dynamically allocated array of Highscore structs. Your program should use three functions that accept the array of Highscore structs:void readData(Highscore scores[], int size) void sortData(Highscore scores[], int size) void displayData(const Highscore scores[], int size) You may use any sort algorithm, but I would recommend using the selection sort from lesson 9.6. Don't use C++'s sort() function, but you can use the swap() function. Note that when you swap…arrow_forwardWrite a function named swapFrontback that takes as input an array ofintegers and an integer that specifies how many entries are in the array. Thefunction should swap the first element in the array with the last elements inthe array. The function should check if the array is empty to prevent errors.The header file for the swapFrontback() is:swapFrontback.h:double swapFrontback (int [] arr,int size);Write a driver (main.c) to test your function with arrays of different lengthand with varrying front and back numbers. Print the array elements beforeand after the swap in the main.c.Sample Run: Original Array: 1 2 3 4 5 6 FrontBack Array: 6 2 3 4 5 1arrow_forward
- Please help me with my code. Create a program in Python using RegEx that reads data from Breakfast Menu (https://www.w3schools.com/xml/simple.xml) and builds parallel arrays for the menu items, with each array containing the menu item name, description, calories, and price, respectively. After reading the data and building the arrays, display the menu items similar to the following: name - description - calories - priceAt the bottom, display the total number of items on the menu, the average number of calories per item, and the average price per item similar to: 0 items - 0 average calories - $0.00 average price You may either read the page using Internet processing methods, or you may download and save the page and then read the data from the saved file. You must process the data using string functions (no XML libraries). must use separate subroutines/functions/methods to implement each type of processing, and include error handling for missing or invalid data. Please use…arrow_forwardIn this lab, you use what you have learned about searching an array to find an exact match to complete a partially prewritten Java program. The program uses an array that contains valid names for 10 cities in Michigan. You ask the user of the program to enter a city name; your program then searches the array for that city name. If it is not found, the program should print a message that informs the user the city name is not found in the list of valid cities in Michigan. The data file provided for this lab includes the input statements and the necessary variable declarations. You need to use a loop to examine all the items in the array and test for a match. You also need to set a flag if there is a match, and then test the flag variable to determine if you should print the "Not a city in Michigan" message. Comments in the code tell you where to write your statements. Study the prewritten code to make sure you understand it. Write a loop statement that examines the names of cities…arrow_forwardIn this project you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string will be converted into an array. The array will be randomly sorted to "shuffle" the deck. Each time the user clicks a Deal button, the last five cards of the array will be removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.arrow_forward
- I wrote this code in c programming. what this code should do is ask how many times its going to run and run that many times(this works), ask how many books there are in a place(this works), then ask the max number of pages you want to read(this works), then asks how many pages there are in a book and put that into an array(works), then sorts the array of pages(works), and then adds the number in the array until you cant which is less than or equal to the max number of pages you want to read, and puts how many books you read(does not work), and then prints out how many books you read. a sample input is 35 206 12 3 10 25 2112 3 6 10 210 319 6 6 3 8 2 12 15 13 7 sample out put should be 345 #include <stdio.h> #include <stdlib.h> void MergeSort(int values[], int start, int end); void Merge(int values[], int start, int middle, int end); void add(int pages[], int count[], long long maxPages, long long total); void Print_Array(int count[], int cases); int main(void) {…arrow_forwardIn C++ language, write a program to print "Junior" if the given array element starts with 'J' and print "Senior" if the array element starts with 's'. Print the name of the player and the message Junior" or "Senior" accordingly. string names [5] = {"J-Liam", "S-Naoh", "S-Elijah", "J-James", "S-Henry"};arrow_forwarduse the array built to shuffle and deal two poker hands. Change the corresponding values for all Jacks through Aces to 11, 12, 13, 14 respectively. Shuffle the deck, then deal two hands. Comment your code and submit the Python code. i wrote a code for it but its not displaying properly, can someone tell me why? (black and white is the array given/ the picture of the python app is what i wrote) its only displaying the array given and not the bottom code i put, why?arrow_forward
- In C language please! You are given an integer array banned and two integers n and maxSum. You are choosing some number of integers following the below rules: ● The chosen integers have to be in the range [1, n]. ● Each integer can be chosen at most once. ● The chosen integers should not be in the array banned. ● The sum of the chosen integers should not exceed maxSum. Return the maximum number of integers you can choose following the mentioned rules Constraint: ● 1 <= banned.length <= 10^4 ● 1 <= banned [i], n <= 10^4 ● 1 <= maxSum <= 10^9 Example 1: Input: banned = [1,2,3,4,5,6,7], n = 8, maxSum = 1 Output: 0 Reason: You cannot choose any integer while following the mentioned conditions. Example 2: Input: banned = [1,6,5], n = 5, maxSum = 6 Output: 2 Reason:.You can choose the integers 2 and 4. 2 and 4 are from the range [1, 5], both did not appear in banned, and their sum is 6, which did not exceed maxSum. Example 3: Input: banned = [11], n = 7, maxSum = 50 Output:…arrow_forwardI need to write a program named Search.java that uses a function called search_string to check whether a string exists in the array or not. 1- The array of strings is iterated using a for loop and the value at every index is compared with the value to be searched in the array. 2- A boolean variable is set if any array value matches with the string. 3- At the end of the loop, this boolean variable is checked to determine if the array contains the string. It may be necessary to import java.util.Arrays then use Arrays.toString, String equals(). Output should be as picture showsarrow_forwardWrite a function IsPalindrome() that takes an array of characters called Items and an integer called size as parameters. Thelatter indicates the size of the array. The function returns true if thestring represented by the stored elements in Items is a palindrome andfalse otherwise. As usual, uppercase and lowercase versions of the sameletter are considered to be different characters. please add appropriate comments at the end of each code line thank youarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education