Third-party APIs(Mapquest example)

i tried to repeat the example from Third-party APIs , exactly Simple Mapquest API example.

I have a strange problem:

If I replace var L with let L

the code doesn’t work and throws an error:

Uncaught TypeError: Cannot read property ‘mapquest’ of undefined
at window.onload (script.js:20)

But with var L everything works again.

This is confused because what I’ve read has boiled down to something like “let is an improved var. Don’t use var”.

Can you please clarify this issue? is it a feature of Mapquest? var? or something completely different?
Thanks and have a nice day.