I am returning to javaScript after a long absence and I've just learnt about ES6 new features. And here it comes the first doubt.
Although I understand that a let variable cannot be declared twice in the same block scope I came across this situation:
function tell(story){
let story = {
story
};
}
And it gives me a error:
Uncaught SyntaxError: Identifier 'story' has already been declared
Using var this works just fine.
1) Does this mean that I will have to declare a variable with a different name of the function's parameter using let (or even const)? This can be very annoying in terms of variable naming.
In order to keep the same name I did:
function tell(story){
story = {
story
};
}
2) In this case the variable story will belong exclusively to the scope of the function tell?