GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ekaone/JavaScript-Goodies: Collection JavaScript goodies, start from map up to spread-operator | 🛠 on working

BranchesTags
Open more actions menu

Latest commit

 

History

25 Commits
25 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
additem.js
additem.js
 
 
arrayShuffle.js
arrayShuffle.js
 
 
async.js
async.js
 
 
backtick.js
backtick.js
 
 
callback.js
callback.js
 
 
checkKeyExist.js
checkKeyExist.js
 
 
closures.js
closures.js
 
 
destructuring.js
destructuring.js
 
 
every.js
every.js
 
 
fibonacci.js
fibonacci.js
 
 
hoc.js
hoc.js
 
 
iife.js
iife.js
 
 
index.js
index.js
 
 
iseven.js
iseven.js
 
 
jsonstringify.js
jsonstringify.js
 
 
linkedin.js
linkedin.js
 
 
map.js
map.js
 
 
maxmin.js
maxmin.js
 
 
objKeys.js
objKeys.js
 
 
objectEntries.js
objectEntries.js
 
 
objectEntriesSlug.js
objectEntriesSlug.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
path.js
path.js
 
 
privateScopeFunction.js
privateScopeFunction.js
 
 
promise.js
promise.js
 
 
promise2.js
promise2.js
 
 
prototype.js
prototype.js
 
 
randomArray.js
randomArray.js
 
 
reduce.js
reduce.js
 
 
reduce2.js
reduce2.js
 
 
reduceAverage.js
reduceAverage.js
 
 
returnMultipleValues.js
returnMultipleValues.js
 
 
spreadOperator.js
spreadOperator.js
 
 
tabnine.js
tabnine.js
 
 
temp.js
temp.js
 
 
test.js
test.js
 
 
this.js
this.js
 
 
timestamp.js
timestamp.js
 
 
topLevelAwait.js
topLevelAwait.js
 
 
useLocalState.js
useLocalState.js
 
 
usePrevious.js
usePrevious.js
 
 
useToggler.js
useToggler.js
 
 

Repository files navigation

JS-Goodies

🔎 Array Shuffle

let list = [1, 2, 3, 4, 5, 6, 7, 8, 9];
list = list.sort(() => Math.random() - 0.5);

console.log(list);
// 1st [ 1, 9, 7, 8, 4, 2, 3, 5, 6 ]
// 2nd [ 7, 8, 4, 3, 6, 9, 5, 2, 1 ]

🔎 Slug

const posts = {
  "mountain-view": {
    name: "Everest",
    height: 8848
  },
  "building-world": {
    name: "Burj Khalifa",
    height: 828
  }
};

const slugs = Object.entries(posts).map(([slug, { name, height }]) => {
  return slug;
});

console.log(slugs); // [ 'mountain-view', 'building-world' ]

🔎 IIFE

(function() {
  // ...
})();

(() => {
  // ...
})();

🔎 Map

const obj = { a: 1, b: 2, c: 3 };

const result = Object.entries(obj).map(([key, value]) => [key, value * 2]);
console.log(result);

🔎 Private Scope

const privateScope = (() => {
  const foo = "Foo";
  const bar = "Bar";
  const printFoo = () => {
    return `hi, i am ${foo}`;
  };
  const printBar = () => {
    return `hi, i am ${bar}`;
  };

  return { printFoo, printBar };
})();

console.log(privateScope.printFoo()); // hi, i am Foo
console.log(privateScope.printBar()); // hi, i am Bar
console.log(privateScope.foo); // undefined

Author

✔ Eka Prasetia 🤵

Blog Twitter Email

✔ Collection my App

Find example all my Scratch App

✔ Community

I am author for two communities in Indonesia

  • GatsbyJS Indonesia Gatsby-ID
  • RedwoodJS Indonesia Redwood-ID

About

Collection JavaScript goodies, start from map up to spread-operator | 🛠 on working

Topics

arrayasyncawacallbackeveryjavascriptmapnodejsobjectspromisereduceslugsomespread-operatortipstricks

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.