Question
l

Question 2 -JS and Python a) Write JavaScript code to create a function called sortstingsDesc that will sort an array of st
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

a)
function sortStringsDesc(strings) {
    strings.sort();
    strings.reverse();
}

b)

def addToFront(lst, item):
    lst.insert(0, item)


Please let me know if you have any doubts Please upvote this answer. Thanks!!

Add a comment
Know the answer?
Add Answer to:
l Question 2 -JS and Python a) Write JavaScript code to create a function called "sortstingsDesc"...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please use proper ES6 JAVASCRIPT SYNTAX including using Let & const correctly Create a function called...

    Please use proper ES6 JAVASCRIPT SYNTAX including using Let & const correctly Create a function called switchLetters that takes a string and an array. *the switchLetters function should accept two arguments , a string and an array. *The function switches letters in the string with a "/" if they are included in the array for example const arr = ['x', 'a', 'h', 'l', 'd' ] replaceLetters('hello', arr) //output: /e//o please do this in javascript es6 syntax

  • Create a file called Sort.py (note the capitalization). Within that file, write two different Python functions....

    Create a file called Sort.py (note the capitalization). Within that file, write two different Python functions. Each function will take an array of integers as a parameter and sort those integers in increasing order. One will use insertion sort, and the other will use selection sort (described below). Simple functions will suffice here; do not create any classes. Your insertion sort function should be called insertion_sort(arr). Your selection sort function should be called selection_sort(arr). Selection sort must use a while...

  • Exercise 2 Using javascript (visual studio code) (a) Write code that creates 5 item objects (records)...

    Exercise 2 Using javascript (visual studio code) (a) Write code that creates 5 item objects (records) (b) Place the five item objects into an array (c) Write a function that prints an array of your items it has one parameter an array of items (d) Write a function that counts items that match some attribute value. (e) Write a function that filters an array of items. It has three parameter an array of item, an attribute name and a value....

  • Python - Write a function called create_basic_pattern(background_colour, size)

    Write a function called create_basic_pattern(background_colour, size) which takes a background colour code and an integer as parameters and returns a list of strings. The list represents the pattern of a pixel art pattern. For example, consider the following code fragment:pattern \(=\) create_basicThen the function should create a list of strings. The size of the list is 8 . Each element is a string with 8 'y' characters:

  • create a file homework_part_1.c a) Implement the function initialize_array that receives two parameters: an array of...

    create a file homework_part_1.c a) Implement the function initialize_array that receives two parameters: an array of integers and the array size. Use a for loop and an if statement to put 0s in the odd positions of the array and 5s in the even positions. You must use pointers to work with the array. Hint: review pointers as parameters. b) Implement the function print_array that receives as parameters an array of integers and the array size. Use a for statements...

  • Add JavaScript code in the “find_primeV2.js” to allow users to enter a number, and then based...

    Add JavaScript code in the “find_primeV2.js” to allow users to enter a number, and then based on the number of user enters, to find out how many prime numbers there are up to and including the user inputted number and then display them on the web page. The following are the detailed steps to complete this assignment: Step 1. [30 points] In “find_primeV2.js”, complete isPrime() function by (1) Adding one parameter in function header. That parameter is used to accept...

  • Write a Javascript function that accepts a string. The function takes the last digit of the...

    Write a Javascript function that accepts a string. The function takes the last digit of the ASCII code and returns a string of digits sorted in ascending order. (without using push, sort or other inbuilt function)

  • Python Question? Write a function called reverse(user_list, num = -1) that takes a list and a...

    Python Question? Write a function called reverse(user_list, num = -1) that takes a list and a number as parameters. The function returns a copy of the list with the first number of items reversed. Conditions: The number parameter must be a default argument. -      If the default argument for number is given in the function call, only the first number of items are reversed. -      If the default argument for number is not provided in the function call, then the...

  • in javascript Write a function named "sort_by_average_rating" that takes a list/array of key-value stores as a...

    in javascript Write a function named "sort_by_average_rating" that takes a list/array of key-value stores as a parameter where each key-value store has keys "ratings", "budget", and "box_office" where budget and box_office are integers and ratings is a list of integers. Sort the input based on the average of the values in "ratings"

  • array function • Create a function called show2D. • This function should accept a two-dimensional array...

    array function • Create a function called show2D. • This function should accept a two-dimensional array as parameter and display its contents that are odd numbers on the screen. • This function should work with any of the following arrays of different sizes: int hours[3][9]; int stamps[7][9]; int cities[15][9]; • Write a demo program to show how to use the function show2D. this is c++ program Task 2: Array functions • Create a function called show2D. • This function should...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT