subject

Will give brainliest and good amount of points, no false answers. i am using javascript for school and i still have no idea what i am doing. can someone ? the instructions are, a key step in many sorting algorithms (including selection sort) is swapping the location of two items in an array. here's a swap function that looks like it might work, but doesn't: -the code prints out [9, 9, 4] when it should print out [9, 7, 4]. fix the swap function. hint: work through the code line by line, writing down the values of items in the array after each step. could you use an extra temporary variable to solve the problem that shows up? once implemented, uncomment the program. assertequal() at the bottom to verify that the test assertion passes. the layout for javascript is, var swap = function(array, firstindex, secondindex) { array[firstindex] = array[secondindex]; array[secondindex] = array[firstindex]; }; var testarray = [7, 9, 4]; swap(testarray, 0, 1); println(testarray); //program. assertequal(testarray, [9, 7, 4]);

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Awell-diversified portfolio needs about 20-25 stocks from different categories.
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
question
Computers and Technology, 24.06.2019 18:50
Which style did jack use on the vocabulary words in reports?
Answers: 2
question
Computers and Technology, 25.06.2019 01:20
Jason typically uses the internet to buy various items. it the total cost of all of the items ordered, at one time, is $250 or more, then the shipping and handling is free, otherwise the shipping and handling is $15 per item. design an algorithm that prompts jason to enter the number of items ordered and the price of each item. (remember cost = number of items order times price) the algorithm then outputs the total billing amount including shipping and handling. your algorithm must use a loop (repetition structure) to get the number and price of each item. write this in algorithm format not program code format.
Answers: 2
You know the right answer?
Will give brainliest and good amount of points, no false answers. i am using javascript for school a...
Questions
question
Mathematics, 18.12.2020 22:40
question
English, 18.12.2020 22:40
question
Mathematics, 18.12.2020 22:40
question
Mathematics, 18.12.2020 22:40
question
Mathematics, 18.12.2020 22:40
Questions on the website: 13722361