Console

Logging

Logging to the console does not require the "console" module since the console variable is global. It can be used anywhere within your code. You can log your message in several different categories.

console.log("Hello, world!");
console.info("I am NativeScript");
console.warn("Low memory");
console.error("Uncaught Application Exception");

Time

Begins counting a time span for a given name (key).

console.time("LoadTime");

Ends a previously started time span through the time method.

console.timeEnd("LoadTime");

Assert

Asserts a boolean condition and prints a message in case the assert fails.

console.assert(2 === 2, "2 equals 2");

Dir

Prints the state of the specified object to the console.

var obj = {name: "John", age: 34};
console.dir(obj);

Trace

Prints the current stack trace in the console.

console.trace();
Is this article helpful? Yes / No
Thank you for your feedback!

Tell us how we can improve this article

NativeScript
NativeScript is licensed under the Apache 2.0 license .
© Progress Software Corporation. All Rights Reserved.