Jump to content

tucker11

Members
  • Posts

    7
  • Joined

  • Last visited

About tucker11

  • Birthday 09/01/1977

Profile Information

  • Gender
    Male
  • Location
    United States

tucker11's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I did some research and noticed exactly what you are saying. I think I got it. Thanks for the heads up!
  2. Is this the correct coding for console.log? document.write('<h1>My Grocery List</h1>'); var groceries = getGroceries(); printGroceries(groceries); function getGroceries() { var debug = true; var input = prompt ("Enable debugging (Y/N)", ""); if (input != "N" && input != "n") debug = true; if (debug) console.log("beginning script"); document.write('<h1>My Grocery List</h1>'); var items = []; do { var basket = prompt("Enter an item to add to the grocery list (enter ‘q’ to quit):"); if(basket != 'q' && basket != 'Q') items.push(basket); } while (basket != 'q' && basket != 'Q') return items; } function printGroceries(groceryItems) { var groceryitems = i; var msg = ''; msg += '<ol>'; for(var i = 0; i < groceryItems.length; i++) { msg += '<li>' + groceryItems + '</li>'; } document.write('<p>Here's your grocery list:</p>' + msg + '</ol>'); }
  3. How can I write my script to a web console (firefox) only when a create a boulean variable called debug set to equal true?
  4. delete account

  5. Is there a way to put "your list is empty" in the external js file without linking to the html?
  6. Thank you, If the user picked q or Q how could i get the the script to respond saying "Your list is empty"v
  7. The point of this code is to get it to populate in and ordered list after the user enters the grocery list value. I need it to list as: 1. Milk 2. Deodarant 3. soda 4. chips Also, if the user enters q or Q without entering items I need the page to read : "Sorry, your grocery list is empty. Any and all assistance will be appreciated! document.write('<h1>My Grocery List</h1>'); var groceries = getGroceries(); printGroceries(groceries); function getGroceries() { var canExit = false; var items = [] do { items = prompt("Enter an item to add to the grocery list (enter ‘q’ to quit):"); } while (items != 'q' && items != 'Q') canExit = true; return items; } function printGroceries(groceryItems) { var groceryitems = i; var msg = ''; msg += '<ol>'; for(var i = 0; i < groceryItems.length; i++) { msg += '<li>' + groceryItems + '</li>'; } document.write('<p>Here's your grocery list:</p>' + msg + '</li>'); }
×
×
  • Create New...