JavaScript:
for (const i in collection) {
var tmp = collection[i];
}Python:
for i in range(len(collection)):
tmp = collection[i]JavaScript:
for (const elem of collection) {
var tmp = elem;
}Python:
for elem in collection:
tmp = elemJavaScript:
for (let index = 0; index < array.length; index++) {
const element = array[index];
}Python:
index = 0
while index < len(array):
element = array[index]
index += 1JavaScript:
for (let index = array.length - 1; index >= 0; index--) {
const element = array[index];
}Python:
index = len(array) - 1
while index >= 0:
element = array[index]
index -= 1JavaScript:
for (const elem of collection) {
if (elem == 2) {
continue
}
var tmp = elem;
}Python:
for elem in collection:
if elem == 2:
continue
tmp = elemJavaScript:
for (const i in collection) {
let elem = collection[i];
if (elem == 2) {
break
}
var tmp = elem;
}Python:
for i in range(len(collection)):
elem = collection[i]
if elem == 2:
break
tmp = elemJavaScript:
function hello() {
for (const i in collection) {
let elem = collection[i];
if (elem == 3) {
return
}
var tmp = elem;
}
}Python:
def hello():
for i in range(len(collection)):
elem = collection[i]
if elem == 3:
return
tmp = elemJavaScript:
function hello() {
for (const i in collection) {
let elem = collection[i];
if (elem == 3) {
return null
}
var tmp = elem;
}
}Python:
def hello():
for i in range(len(collection)):
elem = collection[i]
if elem == 3:
return None
tmp = elemJavaScript:
function hello() {
for (const i in collection) {
let elem = collection[i];
if (elem == 3) {
return elem
}
var tmp = elem;
}
}Python:
def hello():
for i in range(len(collection)):
elem = collection[i]
if elem == 3:
return elem
tmp = elem