New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

abt

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abt

_To run tests:_ `yarn` or `npm i` `yarn test` or `npm t`

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

challenge-0

To run tests:
yarn or npm i
yarn test or npm t


  1. Write a polyfill for reduce method of arrays.

./code/reduce


  1. Write a function that flattens deeply nested arrays.
    ex. input: [[], [1, 2, 3], [4, 5], [], [], [6, 7], [8], [9, 10], [], []]
    ex. output: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

./code/flatten


  1. What would be the output of this code and why?
for (var i = 0; i < 3; i++) {
  setTimeout(function() { alert(i); }, 1000 + i);
}

The output will be 3 alerts containing the number 3. The reasoning behind this is that setTimeout is asynchronous,
and the anonymous function set to execute after the specified timeout holds a reference to i. (closureeee) i is not evaluated
until the function is actually executed, meaning that it will be 3, as that is the value that i will hold at the time of execution.


  1. Write a function called eval, which takes a string and returns a boolean. This string is allowed 6 different characters: 0, 1, &, |, (, and ). eval should evaluate the string as a boolean expression, where 0 is false, 1 is true, & is an and, and | is an or. E.g "(0 | (1 | 0)) & (1 & ((1 | 0) & 0))"

./code/eval


  1. Generate all subsets of a string For Eg ‘water’ should generate ‘wa’, ‘wat’, ‘wate’ etc.

./code/subsets

FAQs

Package last updated on 22 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc