简体   繁体   English

错误TS2339:类型'{new():控制台上不存在属性'log'; 原型:控制台; }”

[英]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 我在Console.log语句中收到此错误,您可以在下面发布的图像中清楚地看到该错误

在此处输入图片说明

You have typo in your script. 您的脚本中有错字。 JavaScript is Case sensitive . JavaScript区分大小写 Enter: 输入:

console.log(hello.message);

Instead Console.log(hello.message); 而是Console.log(hello.message);

You should write 你应该写

console.log(hello.message)

JS is case sensitive. JS区分大小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM