Files
30-seconds-of-code/static-parts/README-start.md
2019-06-05 10:36:07 +03:00

3.8 KiB

Logo

30 seconds of code

License npm Downloads npm Version Known Vulnerabilities
Travis Build Codacy Badge js-semistandard-style
Awesome ProductHunt PRs Welcome

Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.

  • Use Ctrl + F or command + F to search for a snippet.
  • Contributions welcome, please read the contribution guide.
  • Snippets are written in ES6, use the Babel transpiler to ensure backwards-compatibility.
  • You can import these snippets into VSCode, by following the instructions found here.
  • You can search, view and copy these snippets from a terminal, using the CLI application from this repo.
  • If you want to follow 30-seconds-of-code on social media, you can find us on Facebook, Instagram and Twitter.

Package

⚠️ NOTICE: A few of our snippets are not yet optimized for production (see disclaimers for individual snippet issues).

You can find a package with all the snippets on npm.

# With npm
npm install 30-seconds-of-code

# With yarn
yarn add 30-seconds-of-code

CDN link

Details

Browser

<script src="https://unpkg.com/30-seconds-of-code@1/dist/_30s.es5.min.js"></script>
<script>
  _30s.average(1, 2, 3);
</script>

Node

// CommonJS
const _30s = require('30-seconds-of-code');
_30s.average(1, 2, 3);

// ES Modules
import _30s from '30-seconds-of-code';
_30s.average(1, 2, 3);

Contents