Skip to content

Instantly share code, notes, and snippets.

@jessecogollo
Created October 23, 2017 06:34
Show Gist options
  • Save jessecogollo/c11e463407a424d4d7967eb4ae40633a to your computer and use it in GitHub Desktop.
Save jessecogollo/c11e463407a424d4d7967eb4ae40633a to your computer and use it in GitHub Desktop.
format
'use strict';
const {
format
} = require('util');
const strFormat = format('%s:%s', 'foo');//%s -> string
console.log('strFormat', strFormat);
const numberFormat = format('%d:%d', 5.2);
console.log('numberFormat', numberFormat);
const intFormat = format('%i:%i', 5);
console.log('intFormat', intFormat);
const jsonFormat = format('%j:%j', {key: true});
console.log('jsonFormat', jsonFormat);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment