Js :: Promise.all()

Promise.all() source: const times = [2000, 500, 3000, 1000] await Promise.all(times.map(async t => { await stop(t) console.log(t) })) output: 500 1000 2000 3000

August 8, 2021 · 1 min · bynaki

Node :: Usage nvm

Usage NVM To download, compile, and install the latest release of node, do this: nvm install node # "node" is an alias for the latest version To install a specific version of node: nvm install 6.14.4 # or 10.10.0, 8.9.1, etc The first version installed becomes the default. New shells will start with the default version of node (e.g., nvm alias default). You can list available versions using ls-remote: nvm ls-remote And then in any new shell just use the installed version:...

July 29, 2021 · 1 min · bynaki

Js :: Generator

Generator **Generator** 객체는 generator function 으로부터 반환된 값이며 반복자와 반복자 프로토콜을 준수합니다. 문법 function* gen() { yield 1; yield 2; yield 3; } var g = gen(); // "Generator { }" 메서드 Generator.prototype.next() yield 표현을 통해 yield된 값을 반환합니다. Generator.prototype.return() 주어진 값을 반환하고 생성기를 종료합니다. Generator.prototype.throw() 생성기로 에러를 throw합니다. 예시 무한 반복자 function* idMaker(){ var index = 0; while(true) yield index++; } var gen = idMaker(); // "Generator { }" console....

July 26, 2021 · 1 min · bynaki

Node :: Deleting Data in SQLite Database from a Node.js Application

Summary: in this tutorial, you will learn how to delete data in the SQLite database from a Node.js application. To delete data in the SQLite database from a Node.js application, you use the following steps: Open a database connection. Execute a DELETE statement. Close the database connection. For the demonstration, we will use the langs table in the sample.db database that we created in the previous tutorial. Deleting data example To delete data from a table, you use the DELETE statement as follows:...

July 25, 2021 · 2 min · bynaki

Node :: Updating Data in SQLite Database from a Node.js Application

Summary: this tutorial shows you how to update data in the SQLite database from a Node.js application. To update data in the SQLite database from a Node.js application, you use these steps: Open a database connection. Execute an UPDATE statement. Close the database connection. For the demonstration, we will use the langs table in the sample.db database that we created in the previous tutorial. Updating data example To update data in a table, you use the UPDATE statement as follows:...

July 25, 2021 · 2 min · bynaki