howprogrammingworks / function Goto Github PK
View Code? Open in Web Editor NEWFunctions as a method to raise level of code abstraction
Home Page: https://youtube.com/TimurShemsedinov
License: MIT License
Functions as a method to raise level of code abstraction
Home Page: https://youtube.com/TimurShemsedinov
License: MIT License
According to MDN (source):
If function name is omitted, it will be the variable name (implicit name).
If function name is present, it will be the function name (explicit name).
Code exmaple:
const foo = function () {};
foo.name // "foo"
const foo2 = foo;
foo2.name // "foo"
const bar = function baz() {};
bar.name // "baz"
I suggest extending test cases with the following case:
diff --git a/Exercises/4-methods.test b/Exercises/4-methods.test
index a408b22..78eb07d 100644
--- a/Exercises/4-methods.test
+++ b/Exercises/4-methods.test
@@ -10,11 +10,15 @@
},
m3(x, y, z) {
return [x, y, z];
- }
+ },
+ m4: function sum(x, y) {
+ return x + y;
+ },
}, [
['m1', 1],
['m2', 2],
- ['m3', 3]
+ ['m3', 3],
+ ['sum', 2],
]
],
]
introspect
function so that it can handle objects includedintrospect
function so that it can handle recursive objectsparseLines
improvement so that it can process more than one space b/w parameter name and data type'use strict';
const currdObj = {
common: {
sum: (
// Partial sum apply, use first argument
x // first argument which should support summation opertaion
// Example: sum(1)
// Returns: function(y) { return 1 + y }
) => (
// Apply curreied sum to second argument
y // second argument which should support summation operation
// Example: sum(1)(2)
// Returns: 3
) => (
x + y
)
}
};
introspect(currdObj)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.