Giter Site home page Giter Site logo

doileo / potluck-guest-list-and-dish Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 32 KB

This web app helps event organizers manage their guest lists by allowing them to create and assign items, and mark attendance during the event.

CSS 33.86% HTML 28.71% JavaScript 37.43%

potluck-guest-list-and-dish's Introduction

Skillcrush project - potluck-guest-list-and-dish

As part of my Front-End Developer Track at Skillcrush, I completed this project which enabled me to acquire additional front-end development skills.

Table of contents

Overview

The challenge

Users should be able to:

  • Click on an invite button to add a new guest to a list of attendees
  • See the total number of guests attending
  • Be alerted when the guest list is full
  • Click on an assign button to randomly assign potluck items to each guest on the list, and display the assigned items in a separate list.

Screenshot

Links

My process

Built with

  • Flexbox
  • Mobile-first workflow
  • JavaScript

What I learned

Working on this project I could learn:

  • how to use arrays to store and manipulate data.
  • how to generate random numbers using Math.random() and use them to select items from an array.
  • how to use loops to iterate over arrays and perform operations on their contents.

Here are some code snippets for the things mentioned earlier:

{
//using arrays to store and manipulate data
const potluckItems = [
  "potato salad",
  "hummus",
  "cookies",
  "fruit",
  "tomato and mozzarella caprese skewers",
  "chicken salad spring rolls",
  "sandwiches",
  "cucumber noodles",
  "salsa",
  "icebox cake",
  "peach tarts",
  "ice-cream"
];

const allGuests = document.querySelectorAll(".guest-list li");

//using Math.random()
let randomPotluckIndex = Math.floor(Math.random() * potluckItems.length);
let randomPotluckItem = potluckItems[randomPotluckIndex];

//using loops to iterate over arrays
for (let guest of allGuests) {
  let randomPotluckIndex = Math.floor(Math.random() * potluckItems.length);
  let randomPotluckItem = potluckItems[randomPotluckIndex];

  let listItem = document.createElement("li");
  listItem.innerText = `${guest.innerText} is bringing ${randomPotluckItem}.`;
  assignedItems.append(listItem);

  potluckItems.splice(randomPotluckIndex, 1);
}
}

Useful resources

  • Resource 1 - This helped me for getting a detailed guide to working with arrays in JavaScript. It covers topics like creating arrays, adding and removing elements, and using array methods like forEach and map
  • Resource 2 - This is an amazing article which helped me arrays in JavaScript. It covers everything from creating and initializing arrays to using array methods to manipulate their contents.

Author

potluck-guest-list-and-dish's People

Contributors

doileo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.