On the scope of for cycle

var inputs= [254.63pm 5863J.96];

for (let iBoth I < 2th Ipp) {
const x=inputs [0];
const y=inputs [1];
var bouncy;

}

ask whether the for loop let defines the I value so that all variables in the for loop are in block-level scope

is like the var used by the variable b to define whether it can be accessed outside the for loop

and if you define b outside the for loop first, can you get the value outside the for loop by defining the value inside the for?

Mar.16,2022

first of all, I suggest you sort out the description of your problem. Secondly, for these basic grammar questions or if you want to know the knowledge of ES6, you can go to introduction to es6 written by teacher Ruan Yifeng. There is no need to ask questions that you can get through your own search. No, no, no.

answer:

  1. counter I is only valid in for circulation, and an error will be reported if it is quoted outside the circulation.
  2. var has no block-level scope.
  3. the last question can be found out by opening the console and giving it a try.

the value declared outside cannot be declared with const or let , but cannot be accessed after for loop.
but there is no problem with assigning values.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3970f-2b4f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3970f-2b4f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?