Skip to content

Instantly share code, notes, and snippets.

View desinas's full-sized avatar

Dimitrios Kalkasinas desinas

View GitHub Profile
@desinas
desinas / quizLaughItOff.js
Created December 18, 2017 08:52
Laugh it off Quizz (5-2) of Udacity FEWD
/*
* Programming Quiz: Laugh it Off 2 (5-2)
*
* Write a function called `laugh` with a parameter named `num` that represents the number of "ha"s to return.
*
* Note:
* - make sure your the final character is an exclamation mark ("!")
*/
function laugh(num) {
@desinas
desinas / quizBuildTriangle.js
Last active March 18, 2023 17:19
Build a triangle Quiz (5-3) of Udacity FEWD
/*
* Programming Quiz: Build A Triangle (5-3)
*/
// creates a line of * for a given length
function makeLine(length) {
var line = "";
for (var j = 1; j <= length; j++) {
line += "* ";
}
@desinas
desinas / quizLaugh.js
Created December 19, 2017 14:55
Laugh Quiz (5-4) of Udacity FEWD
/*
* Programming Quiz: Laugh (5-4)
*/
var laugh = function(times) {
var haTimes= "";
while (times > 0) {
haTimes +="ha";
times --;
}
@desinas
desinas / quizCry.js
Created December 19, 2017 15:02
Cry Quiz (5-5) of Udacity FEWD
/*
* Programming Quiz: Cry (5-5)
*/
// your code goes here
@desinas
desinas / quizInline.js
Last active December 20, 2017 08:01
Inline Quiz (5-6) of Udacity FEWD
/*
* Programming Quiz: Inline Functions (5-6)
*/
// don't change this code
function emotions(myString, myFunc) {
console.log("I am " + myString + ", " + laugh(2));
}
// your code goes here
@desinas
desinas / quizAnotherTypeOfLoop.js
Last active July 9, 2018 06:13
Another type of loop Quiz (6-8) of Udacity FEWD
/*
* Programming Quiz: Another Type of Loop (6-8)
*
* Use the existing `test` variable and write a `forEach` loop
* that adds 100 to each number that is divisible by 3.
*
* Things to note:
* - you must use an `if` statement to verify code is divisible by 3
* - you can use `console.log` to verify the `test` variable when you're finished looping
*/
@desinas
desinas / quizGotBills.js
Last active February 19, 2021 10:23
I got bills Quiz (6-9) of Udacity FEWD
/*
* Programming Quiz: I Got Bills (6-9)
*
* Use the .map() method to take the bills array below and create a second array
* of numbers called totals. The totals array should contains each amount from the
* bills array but with a 15% tip added. Log the totals array to the console.
*
* For example, the first two entries in the totals array would be:
*
* [57.76, 21.99, ... ]
@desinas
desinas / quizNestedNumb.js
Last active March 19, 2019 12:51
Nested numbers Quiz (6-10) of Udacity FEWD
/*
* Programming Quiz: Nested Numbers (6-10)
*
* - The `numbers` variable is an array of arrays.
* - Use a nested `for` loop to cycle through `numbers`.
* - Convert each even number to the string "even"
* - Convert each odd number to the string "odd"
*/
var numbers = [
@desinas
desinas / quizUmbrella.js
Last active December 21, 2017 10:22
Umbrella Quiz (7-11) of Udacity FEWD
/*
* Programming Quiz: Umbrella (7-1)
*/
var umbrella = {
color: "pink",
isOpen: true,
open: function() {
if (umbrella.isOpen === true) {
return "The umbrella is already opened!";
@desinas
desinas / quizBankAccounts1.js
Last active September 19, 2021 17:38
Bank accounts 1 Quiz (7-3) of Udacity FEWD
/*
* Programming Quiz: Bank Accounts 1 (7-3)
*/
var savingsAccount = {
balance: 1000,
interestRatePercent: 1,
deposit: function addMoney(amount) {
if (amount > 0) {
savingsAccount.balance += amount;