doc: remove extra spaces and concats in examples

PR-URL: https://github.com/nodejs/node/pull/7885
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Joe Esposito 2016-07-26 22:25:08 -04:00 committed by James M Snell
parent 8fbdfb9c4e
commit 6ea8c669df
7 changed files with 14 additions and 14 deletions

View File

@ -423,7 +423,7 @@ const addon = require('./build/Release/addon');
var obj1 = addon('hello'); var obj1 = addon('hello');
var obj2 = addon('world'); var obj2 = addon('world');
console.log(obj1.msg + ' ' + obj2.msg); // 'hello world' console.log(obj1.msg, obj2.msg); // 'hello world'
``` ```

View File

@ -832,7 +832,7 @@ const spawn = require('child_process').spawn;
let child = spawn('sh', ['-c', let child = spawn('sh', ['-c',
`node -e "setInterval(() => { `node -e "setInterval(() => {
console.log(process.pid + 'is alive') console.log(process.pid, 'is alive')
}, 500);"` }, 500);"`
], { ], {
stdio: ['inherit', 'inherit', 'inherit'] stdio: ['inherit', 'inherit', 'inherit']

View File

@ -220,7 +220,7 @@ values similar to `printf(3)` (the arguments are all passed to
var count = 5; var count = 5;
console.log('count: %d', count); console.log('count: %d', count);
// Prints: count: 5, to stdout // Prints: count: 5, to stdout
console.log('count: ', count); console.log('count:', count);
// Prints: count: 5, to stdout // Prints: count: 5, to stdout
``` ```

View File

@ -107,8 +107,8 @@ Example:
const https = require('https'); const https = require('https');
https.get('https://encrypted.google.com/', (res) => { https.get('https://encrypted.google.com/', (res) => {
console.log('statusCode: ', res.statusCode); console.log('statusCode:', res.statusCode);
console.log('headers: ', res.headers); console.log('headers:', res.headers);
res.on('data', (d) => { res.on('data', (d) => {
process.stdout.write(d); process.stdout.write(d);
@ -151,8 +151,8 @@ var options = {
}; };
var req = https.request(options, (res) => { var req = https.request(options, (res) => {
console.log('statusCode: ', res.statusCode); console.log('statusCode:', res.statusCode);
console.log('headers: ', res.headers); console.log('headers:', res.headers);
res.on('data', (d) => { res.on('data', (d) => {
process.stdout.write(d); process.stdout.write(d);

View File

@ -12,7 +12,7 @@ The contents of `foo.js`:
```js ```js
const circle = require('./circle.js'); const circle = require('./circle.js');
console.log( `The area of a circle of radius 4 is ${circle.area(4)}`); console.log(`The area of a circle of radius 4 is ${circle.area(4)}`);
``` ```
The contents of `circle.js`: The contents of `circle.js`:

View File

@ -223,8 +223,8 @@ For example:
```js ```js
process.on('unhandledRejection', (reason, p) => { process.on('unhandledRejection', (reason, p) => {
console.log("Unhandled Rejection at: Promise ", p, " reason: ", reason); console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
// application specific logging, throwing an error, or other logic here // application specific logging, throwing an error, or other logic here
}); });
somePromise.then((res) => { somePromise.then((res) => {

View File

@ -376,12 +376,12 @@ const vm = require('vm');
var localVar = 'initial value'; var localVar = 'initial value';
const vmResult = vm.runInThisContext('localVar = "vm";'); const vmResult = vm.runInThisContext('localVar = "vm";');
console.log('vmResult: ', vmResult); console.log('vmResult:', vmResult);
console.log('localVar: ', localVar); console.log('localVar:', localVar);
const evalResult = eval('localVar = "eval";'); const evalResult = eval('localVar = "eval";');
console.log('evalResult: ', evalResult); console.log('evalResult:', evalResult);
console.log('localVar: ', localVar); console.log('localVar:', localVar);
// vmResult: 'vm', localVar: 'initial value' // vmResult: 'vm', localVar: 'initial value'
// evalResult: 'eval', localVar: 'eval' // evalResult: 'eval', localVar: 'eval'