Skip to content

Instantly share code, notes, and snippets.

View MidasXIV's full-sized avatar
🌴
On vacation

MidasXIV

🌴
On vacation
  • ESRI -Environmental Systems Research Institue
  • Sharjah, United Arab Emirates.
View GitHub Profile
let pokemon = {
"name": "Pikachu",
"id": 25,
"type": "electric",
"ability": {
"primary": "Static",
"hidden": "Lightning rod"
},
"moves": ["Quick Attack", "Volt Tackle", "Iron Tail", "Thunderbolt"]
};
let pokemon = {
"name": "Pikachu",
"id": 25,
"type": "electric",
};
let { type, name, moves } = pokemon;
console.log(`Name :: ${name}`);
console.log(`Type :: ${type}`);
console.log(`moves :: ${moves}`);
let a = 34, b = 89;
console.log(`OLD - a :: ${a} | b :: ${b}`); // OLD - a :: 34 | b :: 89`
// Swap two variables
// let temp = a;
// a = b;
// b = temp;
// Destructuring assignment
[a,b] = [b,a];
console.log(`NEW - a :: ${a} | b :: ${b}`); // NEW - a :: 89 | b :: 34
(() => {
"use strict";
let pokemonTypes = ['electric', 'flying', 'fire', 'grass'];
let pikachu, pidgey, charizard, venusaur;
// pikachu = pokemonTypes[0];
// pidgey = pokemonTypes[1];
// charizard = pokemonTypes[2];
// Skipping Values and default values.
[pikachu, , charizard, venusaur = 'NONE'] = pokemonTypes;
console.log(`Pikachu - ${pikachu}`); // electric
var pokemon = {
id: 25,
name: 'Pikachu',
type: ['electric'],
ability: {
primary: 'Static',
hidden: 'Lightning Rod'
},
moves: ['Quick Attack', 'Thunderbolt', 'Iron Tail', 'Volt Tackle'],
competative: [
@MidasXIV
MidasXIV / varLetConst.js
Created September 4, 2019 07:10
Var vs Let vs Const
// Hoisting
console.log(`var before decleration : ${v}`);
console.log(`let before decleration : ${l}`);
console.log(`const before decleration : ${c}`);
var v = 'VAR'
let l = 'LET'
const c = 'CONST'
var dataStructure = { "head": -1, "Sum":0, "Sequence": [] };
var MSum = 5;
var seq = [1,2,3,7,5];
// var MSum = 15;
// var seq = [1,2,3,4,5,6,7,8,9,10];
var outcome = "-1";
@MidasXIV
MidasXIV / index.html
Created June 26, 2018 05:56
THREE Image Transition
<div id="three-container"></div>
<div id="instructions">
click and drag to control the animation
</div>