Skip to content

Commit fb9e15e

Browse files
committed
Debugging javascript
1 parent 8ac9c89 commit fb9e15e

5 files changed

Lines changed: 58 additions & 0 deletions

File tree

debugging-javascript/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Debugging JavaScript
2+
3+
> [https://www.youtube.com/watch?v=LVXY16PJ_jU](https://www.youtube.com/watch?v=LVXY16PJ_jU)
4+
5+
Install [Node.js](https://nodejs.org).
6+
7+
Within this folder run the terminal command `npm install` to install the
8+
`devDependencies`.
9+
10+
Then run `npm start` to start up a development server on `http://localhost:9966`

debugging-javascript/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// var getBears = require('./lib/get-bears.js')
2+
//
3+
// var noPolar = getBears()
4+
// noPolar.splice(1, 1)
5+
// console.log(noPolar)
6+
//
7+
// var noGrizzly = getBears()
8+
// noGrizzly.splice(0, 1)
9+
// console.log(noGrizzly)
10+
11+
var lots = require('./lib/lots.js')
12+
lots()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = function () {
2+
var bears = ['grizzly', 'polar', 'brown']
3+
debugger
4+
return bears
5+
}

debugging-javascript/lib/lots.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
function addBear (arr) {
3+
arr.push('bear' + arr.length)
4+
}
5+
module.exports.addBear = addBear
6+
7+
module.exports = function () {
8+
debugger
9+
var bears = []
10+
for (var i = 0; i < 100; i++) {
11+
addBear(bears)
12+
}
13+
return bears
14+
}

debugging-javascript/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "debugging-javascript",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "budo index.js"
8+
},
9+
"author": "Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)",
10+
"license": "MIT",
11+
"dependencies": {
12+
"nets": "^3.2.0"
13+
},
14+
"devDependencies": {
15+
"budo": "^5.1.5"
16+
}
17+
}

0 commit comments

Comments
 (0)