Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 1.63 KB

README.md

File metadata and controls

25 lines (19 loc) · 1.63 KB

memory mnemonic for JS Array

Example of code that helps print out all the functions for a JS Array. This helps me memorize all the functions with a mnemonic.

This is the craft secret

Ray("at", ["at"], 9725);
Ray("flat", ["flat", "map", "flatMap"],                             function(treasure)      { treasure });
Ray("forEach2", ["forEach", "find", "filter"],                      function(lightSaber)    { lightSaber });
Ray("indexOf", ["indexOf", "lastIndexOf", "findIndex"],             function(finger)        { finger});
Ray("pop", ["pop", "slice", "splice"],                              function(watermelon)    { watermelon });
Ray("push", ["push", "unshift", "concat"],                          function(kitty)         { kitty });
Ray("shift", ["shift", "reduce", "reduceRight"],                    function(speed)         { speed });
Ray("some", ["some", "includes", "every"],                          function(inclusive)     { inclusive });
Ray("sort", ["sort", "fill", "every"],                              function(worry)         { worry });
Ray("joinToLocaleString", ["toLocaleString", "join", "toString"],   function(party)         { party });
Ray("values2", ["values", "entries", "keys"],                       function(bedVals)       { bedVals });

Additional Inspiration and Resources

Jordan Harb (Leader in NodeJS and Open Source) came up with an approach on how to categorize mutating methods versus non-mutating which relates to JS's ability to be a great functional programming language as in the style "functional programming".

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff