Your example is wrong and you don't explain, for what actually is TS. In the first example you will get an error, too - var message = "text"; message('hello');
Uncaught TypeError: message is not a function
Also: function message(text) {console.log(text); return text;}
Hey vladi, thank you for your comment. When I say 'the first line of code would work' I refer to the line message.length, because message is declared as a string, the line would actually return message length as opposed to the second line which would fail by trying to call message
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Your example is wrong and you don't explain, for what actually is TS. In the first example you will get an error, too -
var message = "text"; message('hello');
Uncaught TypeError: message is not a function
Also:
function message(text) {console.log(text); return text;}
Hey vladi, thank you for your comment. When I say 'the first line of code would work' I refer to the line
message.length
, because message is declared as a string, the line would actually return message length as opposed to the second line which would fail by trying to callmessage