Giter Club home page Giter Club logo

kassraoui marouane's Projects

javascript-training icon javascript-training

Skip to content Search or jump to… Pull requests Issues Marketplace Explore @marouanekassraoui shariquemulla / javaScript-training 1 00 Code Issues 0 Pull requests 0 Actions Projects 0 Wiki Security 0 Insights javaScript-training/JavaScript Training/objects.js / @shariquemulla shariquemulla Intro to JavaScript 4b57bae 8 days ago 115 lines (89 sloc) 2.68 KB Code navigation is available! Navigate your code with ease. Click on function and method calls to jump to their definitions or references in the same repository. Learn more /* * Programming Quiz: Umbrella (7-1) */ var umbrella = { color: "pink", isOpen: true, open: function() { if (umbrella.isOpen === true) { return "The umbrella is already opened!"; } else { umbrella.isOpen = true; return "Julia opens the umbrella!"; } }, close: function(){ if (umbrella.isOpen === false) { return "The umbrella is already closed!"; } else { umbrella.isOpen = false; return "Julia closes the umbrella!"; } } }; ////////////////////////////////////////////////////////////////////////////////////////////////// /* * Programming Quiz: Menu Items (7-2) */ var breakfast = { name: "The Lumberjack", price: 9.95, ingredients: ["eggs", "sausage", "toast", "hashbrowns", "pancakes"] }; ////////////////////////////////////////////////////////////////////////////////////////////////// /* * Programming Quiz: Bank Accounts 1 (7-3) */ var savingsAccount = { balance: 1000, interestRatePercent: 1, deposit: function addMoney(amount) { if (amount > 0) { savingsAccount.balance += amount; } }, withdraw: function removeMoney(amount) { var verifyBalance = savingsAccount.balance - amount; if (amount > 0 && verifyBalance >= 0) { savingsAccount.balance -= amount; } }, printAccountSummary: function print(){ return "Welcome!" + "\n" + "Your balance is currently $"+ savingsAccount.balance +" and your interest rate is "+ savingsAccount.interestRatePercent +"%."; } }; console.log(savingsAccount.printAccountSummary()); //////////////////////////////////////////////////////////////////////////////// /* * Programming Quiz: Facebook Friends (7-5) */ var facebookProfile = { name: "Sharique Mulla", friends: 150, messages: ["Hi","Hello","Udacity","JavaScript"], postMessage: function msg(message){ facebookProfile.messages.push(message); }, deleteMessage: function deleteMsg(index){ facebookProfile.messages.splice(index,1); }, addFriend: function add(){ facebookProfile.friends++; }, removeFriend:function remove(){ facebookProfile.friends--; } }; /////////////////////////////////////////////////////////////////////////////////////// /* * Programming Quiz: Donuts Revisited (7-6) */ var donuts = [ { type: "Jelly", cost: 1.22 }, { type: "Chocolate", cost: 2.45 }, { type: "Cider", cost: 1.59 }, { type: "Boston Cream", cost: 5.99 } ]; donuts.forEach(function print(element){ console.log(element.type +" donuts cost $"+ element.cost +" each"); }); Β© 2020 GitHub, Inc. Terms Privacy Security Status Help Contact GitHub Pricing API Training Blog About

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.