You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read a part of the lib.d.ts and it has declare var name: string;. So I may understand the compiler emits an error. However what concept cannot we use the variable name in TypeScript?
And I think the tutorial which doesn't work is not good :(
Or is there something is wrong with me? I hope to replay an answer :)
The text was updated successfully, but these errors were encountered:
harukaeru
changed the title
let name: string = "bob"; doesn't work.
let name: string = "bob"; doesn't work.
Apr 15, 2016
Because there is already a variable called name on the global scope. Try it out in your browser, console.log(name) and you will see an empty string (or maybe some other string) instead of undefined.
Hello, I start to use TypeScript recently. It's super useful language for me :)
By the way, I'm in a tutorial about
String Type
in here https://www.typescriptlang.org/docs/handbook/basic-types.htmlTypeScript Version:
1.8.10
Code
It doesn't work.
hello.ts
Whenever I compile, the compiler will emit the following.
It works.
hello.ts
Expecting Behavior
I read a part of the
lib.d.ts
and it hasdeclare var name: string;
. So I may understand the compiler emits an error. However what concept cannot we use the variablename
in TypeScript?And I think the tutorial which doesn't work is not good :(
Or is there something is wrong with me? I hope to replay an answer :)
The text was updated successfully, but these errors were encountered: