/**
* Created by city--online on 16/3/9.
*/ //console.time()和console.timeEnd()输出中间代码的执行时间(注意:time和timeEnd的参数必须完全一致)
console.time("hello"); console.log("hello world"); //依次序输出所有字符串
console.log("%s","Hello" ,"World"); //将对象转换为普通字符串后执行
console.log("%s","cuiyanwei",{name:"小崔"}); //将字符串作为数值进行转换
console.log("%d","25.6");
console.log("%d","cuiyanwei"); // 输出%
console.log("%%"); console.log("%%","cyw"); //console.warn的用法和console.error()用法一样
//console.error("this is error"); //console.trace()方法将当前位置处的栈信息作为标准错误信息进行输出.
var obj={
name:"cuiyanwei",
age:24,
eat:function(){ }
}
console.trace(obj); //查看对象里的内容并输出:
console.dir(obj); //显示所有nodejs中的全局变量、函数、对象:
console.log(global); //console.assert()对表达式结果进行评估,如果该表达式的执行结果为false,则输出一个消息字符串并抛出AssertionError异常
console.assert(2==1,"error 2==1"); console.timeEnd("hello");
/usr/local/bin/node Console.js
hello world
Hello World
cuiyanwei { name: '小崔' }
25.6
NaN
%%
% cyw
Trace: { name: 'cuiyanwei', age: 24, eat: [Function] }
at Object.<anonymous> (/Users/city--online/Desktop/Console/Console.js:37:9)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:134:18)
at node.js:962:3
Trace: a
at Object.<anonymous> (/Users/city--online/Desktop/Console/Console.js:39:9)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:134:18)
at node.js:962:3
{ name: 'cuiyanwei', age: 24, eat: [Function] }
{ DTRACE_NET_SERVER_CONNECTION: [Function],
DTRACE_NET_STREAM_END: [Function],
DTRACE_HTTP_SERVER_REQUEST: [Function],
DTRACE_HTTP_SERVER_RESPONSE: [Function],
DTRACE_HTTP_CLIENT_REQUEST: [Function],
DTRACE_HTTP_CLIENT_RESPONSE: [Function],
global: [Circular],
process:
process {
title: '/usr/local/bin/node',
version: 'v4.3.1',
moduleLoadList:
[ 'Binding contextify',
'Binding natives',
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule internal/util',
'Binding util',
'NativeModule timers',
'Binding timer_wrap',
'NativeModule _linklist',
'NativeModule assert',
'NativeModule util',
'Binding uv',
'NativeModule path',
'NativeModule module',
'NativeModule internal/module',
'NativeModule vm',
'NativeModule fs',
'Binding fs',
'NativeModule constants',
'Binding constants',
'NativeModule stream',
'NativeModule _stream_readable',
'NativeModule _stream_writable',
'NativeModule _stream_duplex',
'NativeModule _stream_transform',
'NativeModule _stream_passthrough',
'Binding fs_event_wrap',
'NativeModule console',
'Binding tty_wrap',
'NativeModule net',
'Binding cares_wrap',
'Binding tcp_wrap',
'Binding pipe_wrap',
'Binding stream_wrap' ],
versions:
{ http_parser: '2.5.2',
node: '4.3.1',
v8: '4.5.103.35',
uv: '1.8.0',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '46',
openssl: '1.0.2f' },
arch: 'x64',
platform: 'darwin',
release:
{ name: 'node',
lts: 'Argon',
sourceUrl: 'https://nodejs.org/download/release/v4.3.1/node-v4.3.1.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v4.3.1/node-v4.3.1-headers.tar.gz' },
argv:
[ '/usr/local/bin/node',
'/Users/city--online/Desktop/Console/Console.js' ],
execArgv: [],
env:
{ SHELL: '/bin/bash',
TMPDIR: '/var/folders/65/m0mbnd5515v0k2bnh6pzl75w0000gn/T/',
__CF_USER_TEXT_ENCODING: '0x1F5:0x19:0x34',
PATH: '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
VERSIONER_PYTHON_VERSION: '2.7',
XPC_FLAGS: '0x0',
USER: 'city--online', HOME: '/Users/city--online',
assert.js:89
LOGNAME: 'city--online',
throw new assert.AssertionError({
XPC_SERVICE_NAME: '0',
^
Apple_PubSub_Socket_Render: '/private/tmp/com.apple.launchd.BNOh3IvDtv/Render',
AssertionError: error 2==1
SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.30OLhAehof/Listeners',
at Console.assert (console.js:87:23)
VERSIONER_PYTHON_PREFER_32_BIT: 'no' },
at Object.<anonymous> (/Users/city--online/Desktop/Console/Console.js:46:9)
pid: 5236,
at Module._compile (module.js:409:26)
features:
at Object.Module._extensions..js (module.js:416:10)
{ debug: false,
at Module.load (module.js:343:32)
uv: true,
at Function.Module._load (module.js:300:12)
ipv6: true,
at Function.Module.runMain (module.js:441:10)
tls_npn: true,
at startup (node.js:134:18)
tls_sni: true,
at node.js:962:3
tls_ocsp: true,
tls: true },
_needImmediateCallback: false,
execPath: '/usr/local/bin/node',
debugPort: 5858,
_startProfilerIdleNotifier: [Function: _startProfilerIdleNotifier],
_stopProfilerIdleNotifier: [Function: _stopProfilerIdleNotifier],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
reallyExit: [Function: reallyExit],
abort: [Function: abort],
chdir: [Function: chdir],
cwd: [Function: cwd],
umask: [Function: umask],
getuid: [Function: getuid],
geteuid: [Function: geteuid],
setuid: [Function: setuid],
seteuid: [Function: seteuid],
setgid: [Function: setgid],
setegid: [Function: setegid],
getgid: [Function: getgid],
getegid: [Function: getegid],
getgroups: [Function: getgroups],
setgroups: [Function: setgroups],
initgroups: [Function: initgroups],
_kill: [Function: _kill],
_debugProcess: [Function: _debugProcess],
_debugPause: [Function: _debugPause],
_debugEnd: [Function: _debugEnd],
hrtime: [Function: hrtime],
dlopen: [Function: dlopen],
uptime: [Function: uptime],
memoryUsage: [Function: memoryUsage],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_setupDomainUse: [Function: _setupDomainUse],
_events: { newListener: [Function], removeListener: [Function] },
_rawDebug: [Function],
domain: null,
_maxListeners: undefined,
EventEmitter:
{ [Function: EventEmitter]
EventEmitter: [Circular],
usingDomains: false,
defaultMaxListeners: 10,
init: [Function],
listenerCount: [Function] },
_fatalException: [Function],
_exiting: false,
assert: [Function],
config: { target_defaults: [Object], variables: [Object] },
nextTick: [Function: nextTick],
_tickCallback: [Function: _tickCallback],
_tickDomainCallback: [Function: _tickDomainCallback],
stdout: [Getter],
stderr: [Getter],
stdin: [Getter],
openStdin: [Function],
exit: [Function],
kill: [Function],
_eventsCount: NaN,
mainModule:
Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/city--online/Desktop/Console/Console.js',
loaded: false,
children: [],
paths: [Object] } },
GLOBAL: [Circular],
root: [Circular],
Buffer:
{ [Function: Buffer]
poolSize: 8192,
isBuffer: [Function: isBuffer],
compare: [Function: compare],
isEncoding: [Function],
concat: [Function],
byteLength: [Function: byteLength] },
clearImmediate: [Function],
clearInterval: [Function],
clearTimeout: [Function],
setImmediate: [Function],
setInterval: [Function],
setTimeout: [Function],
console: [Getter] } Process finished with exit code 1

Node.js之Console用法小结的更多相关文章

  1. javascript或node中的console用法总结

    //建立app.js页面 // 一:页面代码 console.log("log信息"); //在页面中执行(node app.js)这个文件会在控制台中看到log信息:" ...

  2. Node.js:console模块

    console模块提供了一个简单的调试功能,类似与web浏览器的javscript console. 下面简单介绍下该模块的使用以及用途,我使用了ES6的模版字符串(使用反引号标识),有兴趣的可以去了 ...

  3. 记一次 node.js 的populate用法

    最近在学习node.js做一个简单的博客的网站,用的express框架和mongodb的数据库.之前没有接触过这个数据库,所有在一开始写的时候遇到了一些问题,如何初始化model类型,又如何实现简单的 ...

  4. node.js 初学(一)—— http fs 服务器/文件/post get

    node.js 初学 —— http fs 服务器/文件/post get 这个世界,从来不会给失败者颁奖! 了解 node.js (开源) node.js 是用来做后台开发的,但是现在大部分前端人员 ...

  5. [转]Getting Start With Node.JS Tools For Visual Studio

    本文转自:http://www.c-sharpcorner.com/UploadFile/g_arora/getting-started-with-node-js-tools-for-visual-s ...

  6. Node.js快速入门

    Node.js是什么? Node.js是建立在谷歌Chrome的JavaScript引擎(V8引擎)的Web应用程序框架. 它的最新版本是:v0.12.7(在编写本教程时的版本).Node.js在官方 ...

  7. Node.js进程管理之Process模块

    在前面Node.js事件运行机制也有提到,Node.js应用在单个线程运行,但是现在大部分服务器都是多处理器,为了方便使用多个进程,Node.js提供了3个模块.Process模块提供了访问正在运行的 ...

  8. JavaScript简明教程之Node.js

    Node.js是目前非常火热的技术,但是它的诞生经历却很奇特. 众所周知,在Netscape设计出JavaScript后的短短几个月,JavaScript事实上已经是前端开发的唯一标准. 后来,微软通 ...

  9. Node.js学习(Node.js基础)

    1.开发环境搭建 v8引擎是作为解析JavaScript程序来运行的 nodejs是一个高性能的,第一个体现在他的JavaScript解析速度很快,v8引擎性能很高,第二个事件驱动和非阻塞 2.全局对 ...

随机推荐

  1. ASP.NET 常用的字符串加密

    字符串常用的加密有三种 1.MD5加密,这个常用于密码,单向加密,不可解密,有些在线解密的可以解大部份,用代码不能实现,如果不想让人解密,加密后随便截取一段就好了: 2.Base64位加密,通常加密后 ...

  2. C#之工厂

    工厂在我看来分为三种分别都是简单工厂,工厂方法,和抽象工厂,这三种都是将使用和创建分开的一种模式 接下来我来介绍一下我理解的简单工厂模式: 在平时我们需要使用生产对象的一个类当我们需要new 一个对象 ...

  3. fatal: Not a git repository (or any parent up to mount point /home)

    问题:fatal: Not a git repository (or any parent up to mount point /home) 解决:git init

  4. php—Smarty-缓存2(26)

    一个页面中,有些数据缓存,有些数据不缓存,就是局部缓存 l  $smarty->assign(“var”, “value”, true) 第三个参数:表示是否不缓存 l  {$var nocac ...

  5. 解决org.apache.lucene.store.AlreadyClosedException: this Directory is closed

    在Lucene中,关闭一个IndexWriter时抛出AlreadyClosedException异常: org.apache.lucene.store.AlreadyClosedException: ...

  6. 确定 RN 中方法的 queue

     如果不指定,每一个模块,都会生成自己的一个串行队列. 可以通过强行声明一个队列来指定所有方法都在这个队列执行 - (dispatch_queue_t)methodQueue { return di ...

  7. 49.RocketMQ 双主搭建(本文非EamonSec原创)

    声明:本文非EamonSec原创,copy自网上下载的某个个文件 1.RocketMQ介绍 1.1. 简介 RocketMQ 是一款分布式.队列模型的消息中间件,具有以下特点: 能够保证严格的消息顺序 ...

  8. 利用atimicInteger cas的特性实现一个锁

    利用atimicInteger cas的特性实现一个锁 主要是使用的是 atomicIntegerAPI 的compareAndSet()方法,让线程不在阻塞,获取不到直接失败. 我们先定义一个异常类 ...

  9. Linux文件索引节点相关概念

    一.  概念 1.  inode(index node)表中包含文件系统所有文件列表 一个节点 (索引节点)是在一个表项,包含有关文件的信息( 元数据 ),包括: 文件类型,权限,UID,GID 链接 ...

  10. 杨辉三角-python

    # -*- coding: utf-8 -*- def triangles(): yield [1] # n = 0 第一行 yield [1, 1] # n = 1 第二行 b, n, old = ...