Is is possible to create a for-of loop without a variable?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite












Suppose I have a function like this:



const hasAny = xs => 
for (const x of xs)
return true;


return false;
;


eslint will complain that x is not used, and indeed it isn't.



Can I write a for-of loop that does not declare any variables?










share|improve this question

















  • 2




    Maybe for what you need with an return xs.length > 0 is enough for you.
    – Jesús Magallón
    15 mins ago






  • 2




    @JesúsMagallón - Not all iterables have a length property.
    – T.J. Crowder
    15 mins ago










  • Would eslint be happy if you named the variable _?
    – Bergi
    10 mins ago










  • @Bergi sadly this isn't ML
    – sdgfsdh
    7 mins ago










  • @sdgfsdh looks like "varsIgnorePattern": "^_" should be the default eslint configuration
    – Bergi
    5 mins ago














up vote
6
down vote

favorite












Suppose I have a function like this:



const hasAny = xs => 
for (const x of xs)
return true;


return false;
;


eslint will complain that x is not used, and indeed it isn't.



Can I write a for-of loop that does not declare any variables?










share|improve this question

















  • 2




    Maybe for what you need with an return xs.length > 0 is enough for you.
    – Jesús Magallón
    15 mins ago






  • 2




    @JesúsMagallón - Not all iterables have a length property.
    – T.J. Crowder
    15 mins ago










  • Would eslint be happy if you named the variable _?
    – Bergi
    10 mins ago










  • @Bergi sadly this isn't ML
    – sdgfsdh
    7 mins ago










  • @sdgfsdh looks like "varsIgnorePattern": "^_" should be the default eslint configuration
    – Bergi
    5 mins ago












up vote
6
down vote

favorite









up vote
6
down vote

favorite











Suppose I have a function like this:



const hasAny = xs => 
for (const x of xs)
return true;


return false;
;


eslint will complain that x is not used, and indeed it isn't.



Can I write a for-of loop that does not declare any variables?










share|improve this question













Suppose I have a function like this:



const hasAny = xs => 
for (const x of xs)
return true;


return false;
;


eslint will complain that x is not used, and indeed it isn't.



Can I write a for-of loop that does not declare any variables?







javascript for-loop






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 19 mins ago









sdgfsdh

7,18863581




7,18863581







  • 2




    Maybe for what you need with an return xs.length > 0 is enough for you.
    – Jesús Magallón
    15 mins ago






  • 2




    @JesúsMagallón - Not all iterables have a length property.
    – T.J. Crowder
    15 mins ago










  • Would eslint be happy if you named the variable _?
    – Bergi
    10 mins ago










  • @Bergi sadly this isn't ML
    – sdgfsdh
    7 mins ago










  • @sdgfsdh looks like "varsIgnorePattern": "^_" should be the default eslint configuration
    – Bergi
    5 mins ago












  • 2




    Maybe for what you need with an return xs.length > 0 is enough for you.
    – Jesús Magallón
    15 mins ago






  • 2




    @JesúsMagallón - Not all iterables have a length property.
    – T.J. Crowder
    15 mins ago










  • Would eslint be happy if you named the variable _?
    – Bergi
    10 mins ago










  • @Bergi sadly this isn't ML
    – sdgfsdh
    7 mins ago










  • @sdgfsdh looks like "varsIgnorePattern": "^_" should be the default eslint configuration
    – Bergi
    5 mins ago







2




2




Maybe for what you need with an return xs.length > 0 is enough for you.
– Jesús Magallón
15 mins ago




Maybe for what you need with an return xs.length > 0 is enough for you.
– Jesús Magallón
15 mins ago




2




2




@JesúsMagallón - Not all iterables have a length property.
– T.J. Crowder
15 mins ago




@JesúsMagallón - Not all iterables have a length property.
– T.J. Crowder
15 mins ago












Would eslint be happy if you named the variable _?
– Bergi
10 mins ago




Would eslint be happy if you named the variable _?
– Bergi
10 mins ago












@Bergi sadly this isn't ML
– sdgfsdh
7 mins ago




@Bergi sadly this isn't ML
– sdgfsdh
7 mins ago












@sdgfsdh looks like "varsIgnorePattern": "^_" should be the default eslint configuration
– Bergi
5 mins ago




@sdgfsdh looks like "varsIgnorePattern": "^_" should be the default eslint configuration
– Bergi
5 mins ago












3 Answers
3






active

oldest

votes

















up vote
6
down vote













No, you can't. You can use the iterator¹ directly, though:



const hasAny = xs => !xs[Symbol.iterator]().next().done;


Or if you want to ensure you proactively release any resources the iterator holds (rather than waiting for them to be released automatically — think DB connection in a generator function or similar):



const hasAny = xs => 
const it = xs[Symbol.iterator]();
const result = it.next().done;
if (it.return) it.return();
return result;
;


Live Example:






const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true






¹ (For any who don't happen to know, for-of uses an iterator under the covers.)






share|improve this answer






















  • //FIXME this doesn't .return() the iterator to close resources
    – Bergi
    13 mins ago











  • @Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
    – T.J. Crowder
    12 mins ago










  • I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
    – Bergi
    8 mins ago











  • @Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
    – T.J. Crowder
    6 mins ago










  • Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
    – Bergi
    34 secs ago

















up vote
1
down vote













According to ESLint issue #2173, you can set a comment to ignore the unused variable. For that, use the following code:



var some_unused_variable; // eslint-disable-line no-unused-vars


A community member of ESLint also states:




We now have a varsIgnorePattern option available for this use case (best suited for ignoring specific unused variable names or patterns across all your files).




And documentation states:




The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.



Examples of correct code for the "varsIgnorePattern": "[iI]gnored" option:



/*eslint no-unused-vars: ["error", "varsIgnorePattern": "[iI]gnored" ]*/

var firstVarIgnored = 1;
var secondVar = 2;
console.log(secondVar);





share
















  • 1




    This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
    – T.J. Crowder
    2 mins ago


















up vote
0
down vote













You can use destructuring with an empty object:



const hasAny = xs => 
for (const of xs)
return true;


return false;
;


UPDATE: This does not work when the list contains undefined.






share|improve this answer






















  • the real beauty of javascript :)
    – Isitar
    12 mins ago






  • 1




    Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
    – Bergi
    12 mins ago











  • @Bergi my mistake, updated to use
    – sdgfsdh
    9 mins ago






  • 1




    ... which doesn't work with undefined.
    – sdgfsdh
    8 mins ago






  • 2




    Now it fails if the iterable's first value is null or undefined.
    – T.J. Crowder
    8 mins ago










Your Answer





StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52667690%2fis-is-possible-to-create-a-for-of-loop-without-a-variable%23new-answer', 'question_page');

);

Post as a guest






























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote













No, you can't. You can use the iterator¹ directly, though:



const hasAny = xs => !xs[Symbol.iterator]().next().done;


Or if you want to ensure you proactively release any resources the iterator holds (rather than waiting for them to be released automatically — think DB connection in a generator function or similar):



const hasAny = xs => 
const it = xs[Symbol.iterator]();
const result = it.next().done;
if (it.return) it.return();
return result;
;


Live Example:






const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true






¹ (For any who don't happen to know, for-of uses an iterator under the covers.)






share|improve this answer






















  • //FIXME this doesn't .return() the iterator to close resources
    – Bergi
    13 mins ago











  • @Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
    – T.J. Crowder
    12 mins ago










  • I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
    – Bergi
    8 mins ago











  • @Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
    – T.J. Crowder
    6 mins ago










  • Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
    – Bergi
    34 secs ago














up vote
6
down vote













No, you can't. You can use the iterator¹ directly, though:



const hasAny = xs => !xs[Symbol.iterator]().next().done;


Or if you want to ensure you proactively release any resources the iterator holds (rather than waiting for them to be released automatically — think DB connection in a generator function or similar):



const hasAny = xs => 
const it = xs[Symbol.iterator]();
const result = it.next().done;
if (it.return) it.return();
return result;
;


Live Example:






const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true






¹ (For any who don't happen to know, for-of uses an iterator under the covers.)






share|improve this answer






















  • //FIXME this doesn't .return() the iterator to close resources
    – Bergi
    13 mins ago











  • @Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
    – T.J. Crowder
    12 mins ago










  • I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
    – Bergi
    8 mins ago











  • @Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
    – T.J. Crowder
    6 mins ago










  • Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
    – Bergi
    34 secs ago












up vote
6
down vote










up vote
6
down vote









No, you can't. You can use the iterator¹ directly, though:



const hasAny = xs => !xs[Symbol.iterator]().next().done;


Or if you want to ensure you proactively release any resources the iterator holds (rather than waiting for them to be released automatically — think DB connection in a generator function or similar):



const hasAny = xs => 
const it = xs[Symbol.iterator]();
const result = it.next().done;
if (it.return) it.return();
return result;
;


Live Example:






const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true






¹ (For any who don't happen to know, for-of uses an iterator under the covers.)






share|improve this answer














No, you can't. You can use the iterator¹ directly, though:



const hasAny = xs => !xs[Symbol.iterator]().next().done;


Or if you want to ensure you proactively release any resources the iterator holds (rather than waiting for them to be released automatically — think DB connection in a generator function or similar):



const hasAny = xs => 
const it = xs[Symbol.iterator]();
const result = it.next().done;
if (it.return) it.return();
return result;
;


Live Example:






const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true






¹ (For any who don't happen to know, for-of uses an iterator under the covers.)






const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true





const hasAny = xs => !xs[Symbol.iterator]().next().done;

console.log(hasAny()); // false
console.log(hasAny([1])); // true






share|improve this answer














share|improve this answer



share|improve this answer








edited 6 mins ago

























answered 17 mins ago









T.J. Crowder

657k11311591257




657k11311591257











  • //FIXME this doesn't .return() the iterator to close resources
    – Bergi
    13 mins ago











  • @Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
    – T.J. Crowder
    12 mins ago










  • I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
    – Bergi
    8 mins ago











  • @Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
    – T.J. Crowder
    6 mins ago










  • Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
    – Bergi
    34 secs ago
















  • //FIXME this doesn't .return() the iterator to close resources
    – Bergi
    13 mins ago











  • @Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
    – T.J. Crowder
    12 mins ago










  • I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
    – Bergi
    8 mins ago











  • @Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
    – T.J. Crowder
    6 mins ago










  • Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
    – Bergi
    34 secs ago















//FIXME this doesn't .return() the iterator to close resources
– Bergi
13 mins ago





//FIXME this doesn't .return() the iterator to close resources
– Bergi
13 mins ago













@Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
– T.J. Crowder
12 mins ago




@Bergi - Meh, it'll get released immediately by any half-decent engine. But I'll add an option.
– T.J. Crowder
12 mins ago












I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
– Bergi
8 mins ago





I didn't mean anything getting garbage collected, I meant e.g. generator functions with a finally clause that actively closes (not just forgets) a connection, rejects a transactions or something.
– Bergi
8 mins ago













@Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
– T.J. Crowder
6 mins ago




@Bergi - Oh, I understand. Eventually GC should get to all of those, since nothing can guarantee proactive cleanup. Still, added the option.
– T.J. Crowder
6 mins ago












Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
– Bergi
34 secs ago




Assuming a network connection that needs to be explicitly closed, the event handler that still waits for packets does itself prevent the connection instance from being garbage-collected. Sure, many constructs don't guarantee active termination, but some cases require them - and would leak otherwise.
– Bergi
34 secs ago












up vote
1
down vote













According to ESLint issue #2173, you can set a comment to ignore the unused variable. For that, use the following code:



var some_unused_variable; // eslint-disable-line no-unused-vars


A community member of ESLint also states:




We now have a varsIgnorePattern option available for this use case (best suited for ignoring specific unused variable names or patterns across all your files).




And documentation states:




The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.



Examples of correct code for the "varsIgnorePattern": "[iI]gnored" option:



/*eslint no-unused-vars: ["error", "varsIgnorePattern": "[iI]gnored" ]*/

var firstVarIgnored = 1;
var secondVar = 2;
console.log(secondVar);





share
















  • 1




    This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
    – T.J. Crowder
    2 mins ago















up vote
1
down vote













According to ESLint issue #2173, you can set a comment to ignore the unused variable. For that, use the following code:



var some_unused_variable; // eslint-disable-line no-unused-vars


A community member of ESLint also states:




We now have a varsIgnorePattern option available for this use case (best suited for ignoring specific unused variable names or patterns across all your files).




And documentation states:




The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.



Examples of correct code for the "varsIgnorePattern": "[iI]gnored" option:



/*eslint no-unused-vars: ["error", "varsIgnorePattern": "[iI]gnored" ]*/

var firstVarIgnored = 1;
var secondVar = 2;
console.log(secondVar);





share
















  • 1




    This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
    – T.J. Crowder
    2 mins ago













up vote
1
down vote










up vote
1
down vote









According to ESLint issue #2173, you can set a comment to ignore the unused variable. For that, use the following code:



var some_unused_variable; // eslint-disable-line no-unused-vars


A community member of ESLint also states:




We now have a varsIgnorePattern option available for this use case (best suited for ignoring specific unused variable names or patterns across all your files).




And documentation states:




The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.



Examples of correct code for the "varsIgnorePattern": "[iI]gnored" option:



/*eslint no-unused-vars: ["error", "varsIgnorePattern": "[iI]gnored" ]*/

var firstVarIgnored = 1;
var secondVar = 2;
console.log(secondVar);





share












According to ESLint issue #2173, you can set a comment to ignore the unused variable. For that, use the following code:



var some_unused_variable; // eslint-disable-line no-unused-vars


A community member of ESLint also states:




We now have a varsIgnorePattern option available for this use case (best suited for ignoring specific unused variable names or patterns across all your files).




And documentation states:




The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.



Examples of correct code for the "varsIgnorePattern": "[iI]gnored" option:



/*eslint no-unused-vars: ["error", "varsIgnorePattern": "[iI]gnored" ]*/

var firstVarIgnored = 1;
var secondVar = 2;
console.log(secondVar);






share











share


share










answered 9 mins ago









E. Zacarias

7510




7510







  • 1




    This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
    – T.J. Crowder
    2 mins ago













  • 1




    This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
    – T.J. Crowder
    2 mins ago








1




1




This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
– T.J. Crowder
2 mins ago





This is true, but it's not an answer to the question. The question doesn't ask how to make ESLint stop complaining. It asks if you can avoid declaring a variable in a for-of loop.
– T.J. Crowder
2 mins ago











up vote
0
down vote













You can use destructuring with an empty object:



const hasAny = xs => 
for (const of xs)
return true;


return false;
;


UPDATE: This does not work when the list contains undefined.






share|improve this answer






















  • the real beauty of javascript :)
    – Isitar
    12 mins ago






  • 1




    Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
    – Bergi
    12 mins ago











  • @Bergi my mistake, updated to use
    – sdgfsdh
    9 mins ago






  • 1




    ... which doesn't work with undefined.
    – sdgfsdh
    8 mins ago






  • 2




    Now it fails if the iterable's first value is null or undefined.
    – T.J. Crowder
    8 mins ago














up vote
0
down vote













You can use destructuring with an empty object:



const hasAny = xs => 
for (const of xs)
return true;


return false;
;


UPDATE: This does not work when the list contains undefined.






share|improve this answer






















  • the real beauty of javascript :)
    – Isitar
    12 mins ago






  • 1




    Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
    – Bergi
    12 mins ago











  • @Bergi my mistake, updated to use
    – sdgfsdh
    9 mins ago






  • 1




    ... which doesn't work with undefined.
    – sdgfsdh
    8 mins ago






  • 2




    Now it fails if the iterable's first value is null or undefined.
    – T.J. Crowder
    8 mins ago












up vote
0
down vote










up vote
0
down vote









You can use destructuring with an empty object:



const hasAny = xs => 
for (const of xs)
return true;


return false;
;


UPDATE: This does not work when the list contains undefined.






share|improve this answer














You can use destructuring with an empty object:



const hasAny = xs => 
for (const of xs)
return true;


return false;
;


UPDATE: This does not work when the list contains undefined.







share|improve this answer














share|improve this answer



share|improve this answer








edited 5 mins ago

























answered 15 mins ago









sdgfsdh

7,18863581




7,18863581











  • the real beauty of javascript :)
    – Isitar
    12 mins ago






  • 1




    Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
    – Bergi
    12 mins ago











  • @Bergi my mistake, updated to use
    – sdgfsdh
    9 mins ago






  • 1




    ... which doesn't work with undefined.
    – sdgfsdh
    8 mins ago






  • 2




    Now it fails if the iterable's first value is null or undefined.
    – T.J. Crowder
    8 mins ago
















  • the real beauty of javascript :)
    – Isitar
    12 mins ago






  • 1




    Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
    – Bergi
    12 mins ago











  • @Bergi my mistake, updated to use
    – sdgfsdh
    9 mins ago






  • 1




    ... which doesn't work with undefined.
    – sdgfsdh
    8 mins ago






  • 2




    Now it fails if the iterable's first value is null or undefined.
    – T.J. Crowder
    8 mins ago















the real beauty of javascript :)
– Isitar
12 mins ago




the real beauty of javascript :)
– Isitar
12 mins ago




1




1




Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
– Bergi
12 mins ago





Nope, this doesn't work for anything that is not an iterable of iterables. Try hasAny([1])
– Bergi
12 mins ago













@Bergi my mistake, updated to use
– sdgfsdh
9 mins ago




@Bergi my mistake, updated to use
– sdgfsdh
9 mins ago




1




1




... which doesn't work with undefined.
– sdgfsdh
8 mins ago




... which doesn't work with undefined.
– sdgfsdh
8 mins ago




2




2




Now it fails if the iterable's first value is null or undefined.
– T.J. Crowder
8 mins ago




Now it fails if the iterable's first value is null or undefined.
– T.J. Crowder
8 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52667690%2fis-is-possible-to-create-a-for-of-loop-without-a-variable%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery