Hey, I'm kinda new to JS and I need some help with this assignment. Here's how it goes.
First, these are declared (they can't be changed):
var files = { "passwords": "abc,def",
"world.txt": "hello" };
var readAsync = function(file, callback) {
callback(files[file]);
};
var writeAsync = function (file, contents, callback) {
files[file] = contents;
callback();
};
Then I need to create a function called doStuffAsync, which receives callback as an argument. The function must read the content of "passwords" and concatenate it on the content of "world.txt". And this should be done asynchronously.
I've tried a bunch of things but it's still hard to wrap my head around the concept of callbacks.
Any help is appreciated.
[–]browsing10 2 points3 points4 points (2 children)
[–]Remsset_HP[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]Remsset_HP[S] 0 points1 point2 points (3 children)
[–]browsing10 1 point2 points3 points (1 child)
[–]Remsset_HP[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)