Same sentiments, and I am pleased with how golang handles this common
desire. Another idea I had is a `for` statement with only one expression of
declarations, or even a new use for the dead `with` statement (conveniently
named).
On Tue, Mar 20, 2018 at 3:57 PM, Rodrigo wrote:
> Proposal: inline
Bit of a silly one, but begging the list's indulgence:
I routinely explain various JavaScript topics to learners, including arrow
functions, method syntax, etc. When I want to contrast "arrow function"
(for instance) with functions defined with `function`, it trips me up, and
often I end up saying
I've always referenced them as:
Function declarations:
function a() {}
Function expression:
const a = function() {}
Named function expression:
const b = function a() {}
Arrow function:
const a = () => {}
Not sure it's 100% semantic or descriptive, but it's how I've
differentiated.
Eli Per
"function" function is the best out of all of the alternatives you
mentioned.
"Anonymous function declared with the function keyword" if it's not too
wordy.
On Sat, 7 Apr 2018 at 23:50 Eli Perelman wrote:
> I've always referenced them as:
>
> Function declarations:
>
> function a() {}
>
> Funct
I don't like the fact the only way to sort is in-place with Array#sort and I
can't be the first to feel this way or wonder why there isn't a built-in
solution.
Obviously, searching "javascript array.sort" doesn't produce any helpful
results to see if someone has suggested this before since all
> Le 7 avr. 2018 à 21:59, Rob Ede a écrit :
>
> I don't like the fact the only way to sort is in-place with Array#sort and I
> can't be the first to feel this way or wonder why there isn't a built-in
> solution.
>
> Obviously, searching "javascript array.sort" doesn't produce any helpful
>
To be super explicit: given an array 'a', then: `Array.from(a).sort()` will
return you a sorted clone. That works even if `a` has an iterator or is an
array-like object. That's just seven characters longer than
`Array.sort(a)`, which is what you seem to be proposing.
To be sure, I don't think th
"keyword function" might not be too bad, either...
--scott
On Sat, Apr 7, 2018 at 2:32 PM, Naveen Chawla wrote:
> "function" function is the best out of all of the alternatives you
> mentioned.
>
> "Anonymous function declared with the function keyword" if it's not too
> wordy.
>
> On Sat, 7 Ap
On Sat, Apr 7, 2018 at 8:59 PM, Rob Ede wrote:
> ...I'm considering creating a proposal to add an Array.sort()
> method that takes an array and returns a new array...
That would be:
```js
let newArray = originalArray.slice().sort();
// or
let newArray = Array.from(originalArray).sort();
// or
le
I just call them "regular functions", "function declarations", or
similar. I'll add "arrow" if there's an arrow, and "async" if there's
an `async` keyword.
-
Isiah Meadows
m...@isiahmeadows.com
Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmea
When I need a non-in-place sort, I just do `array.slice().sort()`.
It's pretty easy, and it still chains. (In my experience, it's rarely
necessary considering most chaining methods like `.map` and `.filter`
already return new instances.)
-
Isiah Meadows
m...@isiahmeadows.com
Looking for web c
`slice()` is better than `Array.from()` if you already have an array
because you can chain it with the other Array.prototype methods.
Good point about not needing it after you've done a map/filter/concat or
whatever, since you already have a new array.
However I agree with the thrust of a proposa
if you want to adhere to the python/jslint philosophy of “there should be one
and preferably only one common design-pattern to do it”, then array.from is the
most suitable candidate for copying/coercing lists. it can generalise to
common pseudo-lists like function-arguments and frontend-query-s
I usually say "function function," but yeah ... it’s painful haha. I
sometimes work with devs whose experience with ES functions is limited to
methods and arrow functions, so "normal function" doesn’t really fly
anymore. I’ve considered "classic function," but that probably wouldn’t
help much.
I h
14 matches
Mail list logo