This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dealing with the Location | |
var location = require('./learningLocation.js'); | |
// dealing with the Weather | |
var weather = require('./learningWeather.js'); | |
// test the script. | |
// this works!! | |
location(function(userLocation){ | |
console.log('Location is: ', userLocation); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file generates output | |
module.exports = function(callback) { | |
callback('This is a model answer provided by Andrew Mead.'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make data available to decon_t1_callingFile.js | |
module.exports = function(){ | |
console.log('Output from file decon_t1calledFile.js'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(callback){ | |
function () { | |
// Contents of this anonymous function will serve as output | |
// from this file | |
console.log('** Output from decon_t2_calledFile.js ** '); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Using accessing an external local file ie one on this computer | |
*/ | |
var weather = require('./weather.js'); | |
var location = require('./location2.js'); | |
/* | |
weather(function(currentWeather) { | |
currentWeather; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"firstName": "Henry", | |
"lastName": "Lawson", | |
"isAlive": true, | |
"age": 25, | |
"address": { | |
"streetAddress": "21 2nd Street", | |
"city": "New York", | |
"state": "NY", | |
"postalCode": "10021-3100" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Example JSON Discoveryvip</title> | |
<meta name="description" content"Discoveryvip.com> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The example provided had a 'throw new Error' statement in the try section | |
see below | |
*/ | |
try { | |
throw new Error('Unable to do the thing you wanted'); | |
} catch(e){ | |
console.log(e.message); | |
} finally { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doWork(){ | |
// throw an error that says unable to work | |
console.log("Unable to work!"); | |
} | |
try { | |
// call doWork() | |
throw new Error(doWork()); | |
} catch (e) { | |
console.log(e.message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Starting password manager.'); | |
var crypto = require('crypto-js'); | |
var storage = require('node-persist'); // integrates node-persist module into this application | |
storage.initSync(); // prepares the computer to write and save variables | |
/* | |
var retrievedAccount = storage.getItemSync('account'); | |
console.log("Account is ", retrievedAccount); | |
*/ |
NewerOlder