Question

ARRAYS - JavaScript Web Development What are two ways an online store website might use an...

ARRAYS - JavaScript Web Development

What are two ways an online store website might use an array and why this is a good technique and two ways that conditional statements (if, if - then, if - if - then - else, or switch case) help to streamline your visitor's experience? Please include code showing what the two arrays might look like.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Arrays can be used in a variety of purposes in a website.

Like to store a list of shopping items, or the total available items in the store currently.

We can store the items as strings, or their positions as numbers or both as an array of array.

Like

array = [["milk", 1], ["bread", 2], ["eggs", 3]]

Conditional statements :

If, if then, if else,

If a user is applying some filters. these statements will be helpful like :

1. On price : If (price of item) > 200 & < 1000, show

2. On listings: If the number of items is less than 20, show

else split into pages

3. Payments : if item is in cart, then show discounted price

else show the normal price

Add a comment
Know the answer?
Add Answer to:
ARRAYS - JavaScript Web Development What are two ways an online store website might use an...
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
  • Easy Javascript questions You can use window.history to retrieve the history object. Using the history object, what methods can you call to navigate backwards and forward to web pages that have been...

    Easy Javascript questions You can use window.history to retrieve the history object. Using the history object, what methods can you call to navigate backwards and forward to web pages that have been visited recently? The answer is not in the book. See https://developer.mozilla.org/en-US/docs/Web/API/History. Think about the situation where the alert message displays “your reply was false.” Describe the type of person who would generate that output—someone who always tells the truth, someone who always lies, or some other type of...

  • By the end of this week, your Career Development Research paper rough draft is due.   To ensure you receive ample fee...

    By the end of this week, your Career Development Research paper rough draft is due.   To ensure you receive ample feedback on your draft as well as ideas to improve it, please post your draft to the discussion board this week. This will allow your classmates to offer ideas.   When you examine the drafts submitted by others, please comment on the following: 1) Is the thesis offered by the writer effective? Why/why not? 2) Do you notice any issues with...

  • Can someone help fix this JAVASCRIPT code according to comment instructions javascriot code: window.addEventListener("click", () =>...

    Can someone help fix this JAVASCRIPT code according to comment instructions javascriot code: window.addEventListener("click", () => { console.log("You clicked?"); }); let button = document.querySelector("button"); button.addEventListener("click", () => { console.log("First Button clicked."); }); // How can we modify this so that it will occur when the 2nd button is clicked? // We need to use querySelectorAll which will produce a nodelist/array of all the buttons. Then we can reference which button we want to apply the click event using [] with...

  • For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java...

    For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java program that will input a file of sentences and output a report showing the tokens and shingles (defined below) for each sentence. Templates are provided below for implementing the program as two separate files: a test driver class containing the main() method, and a sentence utilities class that computes the tokens and shingles, and reports their values. The test driver template already implements accepting...

  • Summary Write a program that demonstrates the skills you’ve learned throughout this quarter. This type of...

    Summary Write a program that demonstrates the skills you’ve learned throughout this quarter. This type of project offers only a few guidelines and requirements, allowing you to invest as much time, effort and imagination as you want.  Submit your java programs (*.java) and any other I/O (*.txt) via Canvas  You’ve worked quite hard to make it this far, so have a bit of fun with this project! Design Brief: Use Case Scenario You are hired to develop a...

  • hello there, i have to implement this on java processing. can someone please help me regarding...

    hello there, i have to implement this on java processing. can someone please help me regarding that? thanks War is the name of a popular children’s card game. There are many variants. After playing War with a friend for over an hour, they argue that this game must never end . However! You are convinced that it will end. As a budding computer scientist, you decide to build a simulator to find out for sure! You will implement the logic...

  • 1. In what ways was Microsoft’s behaviour (a) against the public interest; (b) in the public...

    1. In what ways was Microsoft’s behaviour (a) against the public interest; (b) in the public interest? 2. Being locked in to a product or technology is only a problem if such a product can be clearly shown to be inferior to an alternative. What difficulties might there be in establishing such a case? etwork effects Microsoft is a vertically integrated firm (see page 87), with a dominant position in the operating system market (i.e. Windows) and in certain application...

  • Summary task: C++ language; practice combining tools(functions, arrays, different kind of loops) to solve somewhat complex...

    Summary task: C++ language; practice combining tools(functions, arrays, different kind of loops) to solve somewhat complex problem. Description A Valiant Hero is about to go on a quest to defeat a Vile Monster. However, the Hero is also quite clever and wants to be prepared for the battle ahead. For this question, you will write a program that will simulate the results of the upcoming battle so as to help the hero make the proper preparations. Part 1 First, you...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

  • One example of computer-aided design (CAD) is building geometric structures inter- actively. In Chapter 4, we...

    One example of computer-aided design (CAD) is building geometric structures inter- actively. In Chapter 4, we will look at ways in which we can model geometric objects comprised of polygons. Here, we want to examine the interactive part. Let’s start by writing an application that will let the user specify a series of axis- aligned rectangles interactively. Each rectangle can be defined by two mouse positions at diagonally opposite corners. Consider the event listener canvas.addEventListener("mousedown", function() { gl.bindBuffer(gl.ARRAY_BUFFER, vBuffer); if...

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