Total Members Voted: 140
show people what it's like to go thru the military
okay since the programming megathread is dead, and google isn't really doing it justice, can someone or everyone explain callback functions to me in javascript? I'd like to genuinely get what they are at an intuitive levelCode: [Select]function read(file, callback) { fs.readFile(file, 'utf8', function(err, data) { if (err) { console.log(err); } callback(data); });}if(message.content.startsWith(prefix + "help")) { read('help.txt', function(data) { message.reply(data); });}as I understand it, callback(data) passes the variable back to the second parameter in the read function. when I put a function parameter into that read function, it sends the variable to that function? I feel like this code may be overcomplicated though, I know I can use => too but I want to keep it simple at first here
function read(file, callback) { fs.readFile(file, 'utf8', function(err, data) { if (err) { console.log(err); } callback(data); });}if(message.content.startsWith(prefix + "help")) { read('help.txt', function(data) { message.reply(data); });}
Drink after dinner
drink during dinner
i wanna drink the vodka i bought but my dad and i are to prepare dinner soon and i dont wanna show up smashed what do
eaten
yes drink while eating resonte