Buscador

domingo, 3 de mayo de 2015

Node.js: Depuración (Debug) con node-inspector

En la consola, utilizamos la herramienta node package manager para instalar el módulo node-inspector:

$ npm install -g node-inspector



Uso:

$ node-debug {myapp}.js //normal debug

Ejemplo:

Tenemos la clase AddRemoveItems.js



/* Push and pop methods */

var myArray = ['1', '2', '3'];
myArray.push('4'); // insert the number 4 at the final
console.log(myArray); // Will render ['1', '2', '3', '4']
console.log(myArray.pop()); // Will remove the last item array ('4');
console.log(myArray); // [Will render ['1', '2', '3']
/* Shift and UnShift methods */
myArray.unshift('0'); // Will include '0' at the first position of the array
console.log(myArray); // Will render ['0','1', '2', '3']
console.log(myArray.shift()); // Will remove first item of the array
console.log(myArray); // Will render ['1', '2', '3']

Fuente: https://www.youtube.com/user/Josematube

No hay comentarios:

Publicar un comentario