Vishal Mamidi
Vishal Mamidi

Reputation: 55

error TS2339: Property 'log' does not exist on type '{ new (): Console; prototype: Console; }'

class helloworld 
{
   constructor(public message: string){}
}
var hello = new helloworld('hello vishal');
Console.log(hello.message);

I am getting this error at Console.log statement you can see the error clearly in the image i posted below

enter image description here

Upvotes: 2

Views: 6821

Answers (2)

Andriy Ivaneyko
Andriy Ivaneyko

Reputation: 22041

You have typo in your script. JavaScript is Case sensitive. Enter:

console.log(hello.message);

Instead Console.log(hello.message);

Upvotes: 8

PolishDeveloper
PolishDeveloper

Reputation: 950

You should write

console.log(hello.message)

JS is case sensitive.

Upvotes: 2

Related Questions