控制台

NativeScript 的全局 console 变量允许你将值打印到终端以进行调试。最简单的用法是将值传递给 console.log() 函数:

console.log("hello world");

所述 console 对象有几种其它方法,包括 dump()trace()assert()更多

// Prints the state of a full object.
console.dump({ firstName: "Native", lastName: "Script"}); 

// Prints the current stack trace
console.trace();

// Asserts a boolean condition, and prints to the console if the assertion fails.
console.assert(1 === 1, "This won’t print as the condition is true");
console.assert(1 === 2, "This will print as the condition is false");