hello! how the javascript read this code?
function eqAll(iterable) {
let last
for (const tick of iterable) {
if (last === undefined) last = tick
if (tick !== last) return false
}
return true
}
hello! how the javascript read this code?
function eqAll(iterable) {
let last
for (const tick of iterable) {
if (last === undefined) last = tick
if (tick !== last) return false
}
return true
}
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
Note: Backticks are not single quotes.
what do you not understand of the code you wrote?
how javascript read it. if i input (“aaa”)?
i need to know how javascript work with this code!
how much are you familiar with javascript? what do you understand? it is easier to explain what’s going on if I know what you know
you can also just use this tool: http://pythontutor.com/javascript.html#mode=edit