Lipstick Socialism

I like a news story that makes me smile: a smug, all-knowing, self-satisfied smile. Alexandria Ocasio-Cortez, the 28-year-old Democratic Socialist Latina who recently won the House primary in…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Technical Interview Question with JS Currying

Below is the question:

Both of the above are valid in Javascript (the second call involves currying), but obviously they are not the same. So, the solution I cam across is relatively simple:

So, in the above, the “if” in the definition solves for the first type of function invocation. If there is a second argument, the function adds the two arguments together. If not, then a different function is called (currying!) and the second invocation works.

This is a very quick overview on this problem, and obviously my solution is not perfect, but it solves the problem and you get a very general overview of currying and different function invocations.

Add a comment

Related posts:

Why does my girlfriend keep on thinking that she needs to change herself to be loved when I always love her the way she is?

She is insecure and doesn’t love herself yet. She doesn’t view herself as the beautiful special girl she is. Maybe to you, you see a sweet amazing girl who is smart and loyal, but to her she sees…