Full Stack Daily Evening Dec-27-2021

Full Stack Daily Evening Dec-27-2021

Scratchpad #1 HTML

Scratchpad #2 HTML/CSS

HTML/CSS Scratchpad

HTML/CSS Scratchpad

JS Scratchpad #1

let score = 100 + 3;

let highScore = 100 / 2;

let age = 20;

score + age;

JS scratchpad #2

let greeting = 'Hello World, Welcome to RST Forum.';

greeting.toLowerCase().indexOf('hello');

JS Scratchpad #3

// let cart = 10;
// let message = 'You have ' + cart + ' items in your cart.';
// let username = 'john123';

// let hello = `Hello There,
// This is a multi-line
// string.`;

// let message2 = `Hello $${username.toUpperCase()}, You have ${
//   (cart * 2) / 2
// } items in your cart`;

// console.log(message2);

// console.log(hello);

// let highScore = null;
// let score;

// console.log(highScore);
// console.log(score);

// 'hello world'[100];

// console.log(Math.PI);

// Math.floor(Math.random() * 10) + 1;

// let age = 85;

// if (age > 21) {
//   console.log('Welcome');
// }

// let num = 97;

// if (num % 2 === 0) {
//   console.log('This number is EVEN.');
// } else {
//   console.log('This number is ODD');
// }

// let age = 22;

// if (age >= 65) {
//   console.log('Drinks are free.');
// } else if (age >= 21) {
//   console.log('You are allowed to enter and drink.');
// } else if (age >= 18) {
//   console.log('You are allowed to enter but you cannot drink.');
// } else {
//   console.log('Access denied.');
// }

// let age = 65;

// if (age > 18) {
//   console.log('Entry Granted!');
// } else if (age >= 21) {
//   console.log('Drinks Allowed');
// } else if (age >= 65) {
//   console.log('Drinks FREE!');
// }

// if (age > 18) {
//   if (age >= 65) {
//     console.log('Drinks are free');
//   } else if (age >= 21) {
//     console.log('Drinks allowed');
//   } else {
//     console.log('You can enter');
//   }
// } else {
//   console.log('You cannot enter');
// }

// let password = 'hello world@123';

// if (password.length >= 6) {
//   if (password.indexOf(' ') !== -1) {
//     console.log('Password cannot include spaces');
//   } else {
//     console.log('Valid Password');
//   }
// } else {
//   console.log('Invalid password. Min 6 chars required.');
// }

// let username = 'john123';

// if (username) {
//   console.log('Access granted');
// } else {
//   console.log('Access denined');
// }

let age = 22;

if (age >= 65) {
  console.log('Drinks are free.');
} else if (age >= 21) {
  console.log('You are allowed to enter and drink.');
} else if (age >= 18) {
  console.log('You are allowed to enter but you cannot drink.');
} else {
  console.log('Access denied.');
}

if (age >= 18 && age < 21) {
  onsole.log('You are allowed to enter but you cannot drink.');
} else if (age >= 21 && age < 65) {
  console.log('You are allowed to enter and drink.');
} else if (age > 65) {
  console.log('Drinks are free.');
} else {
  console.log('Access denied.');
}

Scratchpad 4

// if (day === 1) {
//   console.log('Monday');
// } else if (day === 2) {
//   console.log('Tuesday');
// } else if (day === 3) {
//   console.log('Tuesday');
// }

// let day = 10;

// switch (day) {
//   case 1:
//     console.log('Mon');
//     break;
//   case 2:
//     console.log('Tue');
//     break;
//   case 3:
//     console.log('Wed');
//     break;
//   case 4:
//     console.log('Thu');
//     break;
//   case 5:
//     console.log('Fri');
//     break;
//   case 6:
//     console.log('Sat');
//     break;
//   case 7:
//     console.log('Sun');
//     break;
//   default:
//     console.log('Invalid day no.');
// }

// let num = 12;

// if (num === 13) {
//   console.log('Lucky');
// } else if (num === 17) {
//   console.log('Even luckier');
// } else {
//   console.log('Unlucky');
// }

// num === 13
//   ? console.log('Lucky')
//   : num === 17
//   ? console.log('Even luckier')
//   : console.log('Unlucky');

let status = 'offline';

let color = status === 'offline' ? 'red' : 'green';

console.log(color);

Scratchpad #5

// const product1 = ['Apple', 'iPhone', 100000, 100, 'Some description'];
// const product2 = ['Nord X', 'One Plus', 60000, 3000, 'Some description again'];
// const product3 = ['Apple', 'iPhone', 100, 100000, 'Some description'];

// const products = [product1, product2];

// console.log(products);

// product1[0];

// const product4 = {
//   name: 'iPhone',
//   price: 100000,
//   brand: 'Apple',
//   inStock: 100,
//   description: 'Some description',
//   'hello world': 'Good',
//   1000: 'xxxxxxx',
// };

// console.log(product1[0]);

// console.log(product4.name);

// console.log(product4['hello world']);

// console.log(product4[1000]);

// const nums = ['John', 'Jack', 'Jane', 'James'];

const nums2 = {
  0: 'John',
  1: 'Jack',
  2: 'Jane',
  3: 'James',
  '-1': 'sadsad',
  length: 4,
};

console.log(nums2['0']);

Scratchpad #6

// let name = 'John Doe';
// let age = 20;

// let names = ['John Doe', 'Jane Doe', 'Jack Doe'];

// // let product = ['iPhone', 'Apple', 100000, 25];
// // console.log(product[0]);
// // console.log(product[2]);

// // let product = {
// //   price: 100000,
// //   brand: 'Apple',
// //   name: 'iPhone',
// //   inStock: 25,
// // };

// // product.description = 'Some information about...';
// // product.name = 'iPhone 13';
// // product['price'] = 10000;

// // console.log(product);
// // console.log(product.name);
// // console.log(product.price);

// const playlist = [
//   {
//     name: 'Some song #1',
//     artist: ['Artist #1', 'Artist #2'],
//     trackTime: 3.12,
//     metadata: {
//       label: 'T-series',
//       id: 213213213,
//     },
//   },
//   {
//     name: 'Some song #1',
//     artist: ['Artist #1', 'Artist #2'],
//     trackTime: 3.12,
//     metadata: {
//       label: 'T-series',
//       id: 213213213,
//     },
//   },
//   {
//     name: 'Some song #1',
//     artist: ['Artist #1', 'Artist #2'],
//     trackTime: 3.12,
//     metadata: {
//       label: 'T-series',
//       id: 213213213,
//     },
//   },
//   {
//     name: 'Some song #1',
//     artist: ['Artist #1', 'Artist #2'],
//     trackTime: 3.12,
//     metadata: {
//       label: 'T-series',
//       id: 213213213,
//     },
//   },
// ];

// // JSON

// // console.log(playlist[0].name);
// console.log(playlist[0].artist[0].toUpperCase());

// for (let i = 0; i < 10; i++) {
//   console.log(`${i} - Hello World`);
// }

// for (let i = 100; i > 0; i += 10) {
//   console.log(`${i} - Hello World`);
// }

// const nums = [12, 34, 56, 34, 78, 54, 23, 12];

// for (let i = 0; i < nums.length; i++) {
//   console.log(nums[i]);
// }

// const movies = [
//   { movieName: 'Inception', rating: 3.8 },
//   { movieName: 'Avengers', rating: 3.4 },
//   { movieName: 'Iron Man', rating: 2.9 },
// ];

// for (let i = 0; i < movies.length; i++) {
//   let movie = movies[i];
//   console.log(`${movie.movieName} has a rating of ${movie.rating}`);
// }

// const word = 'Hello World';

// let reveredWord = '';

// for (let i = word.length - 1; i >= 0; i--) {
//   // console.log(word[i]);
//   reveredWord += word[i];
// }

// console.log(reveredWord);

// for (let i = 1; i <= 5; i++) {
//   console.log(i + ' OUTER');
//   for (let j = 1; j <= 3; j++) {
//     console.log('   ' + j + ' INNER');
//   }
// }

// const gameBoard = [
//   [4, 64, 8, 4],
//   [128, 32, 4, 16],
//   [16, 4, 4, 32],
//   [2, 16, 16, 2],
// ];

// for (let i = 0; i < gameBoard.length; i++) {
//   for (let j = 0; j < gameBoard[i].length; j++) {
//     console.log(gameBoard[i][j]);
//   }
// }

// const gameBoard = [
//   [
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//   ],
//   [
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//   ],
//   [
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//   ],
//   [
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//     [4, 64, 8, 4],
//   ],
// ];

// for (let i = 0; i < 10; i++) {
//   console.log(i);
// }

// console.log(i);

// let j = 0;

// while (j < 10) {
//   console.log(j);
//   j++;
// }

// let randomNumber = Math.floor(Math.random() * 100) + 1;
// let guess = Math.floor(Math.random() * 100) + 1;

// while (guess !== randomNumber) {
//   console.log(`Random Num: ${randomNumber} | Guess: ${guess}`);
//   guess = Math.floor(Math.random() * 100) + 1;
// }

// console.log(`Random Num: ${randomNumber} | Guess: ${guess}`);

// let str = 'abcdefghijklmnopqrstuvwxyz1234567890';

// let randomNum = Math.floor(Math.random() * str.length - 1);

// console.log(str[randomNum]);

let randomNumber = Math.floor(Math.random() * 100000) + 1;
let guess = Math.floor(Math.random() * 100000) + 1;

while (true) {
  if (guess === randomNumber) {
    console.log("Awesome you've guessed it.");
    break;
  }
  console.log(`Random Num: ${randomNumber} | Guess: ${guess}`);
  guess = Math.floor(Math.random() * 100000) + 1;
}

console.log(`Random Num: ${randomNumber} | Guess: ${guess}`);

Scratchpad #1

let num = 10;

let x = 5;

15;

let result = 20;

undefined;

Scratchpad #2

// let highScoreOfPlayerOne = 10;
// let player1Score = 10;
// let GST_RATE = 18;

// let $highScore = 10;
// let _highScore = 10;
// let high_score = 10;

// let if = 10

// let num1 = 1;
// let num2 = '1';

// let result = num1 + num2;

// console.log(result);

let greeting = 'Hello World, Welcome to RST Forum.';

console.log(greeting.toUpperCase());
console.log(greeting.toLowerCase());

// Ctrl + `
// ls