class JsonWalker {
constructor(content) {
this.content = content;
}
get firstChild() {
return new JsonWalker(this.content.children[0]);
This native Node hot-reloading server implementation uses the EventSource Web API to unidirectionally send pings from the server to the client whenever the client should refresh the page. The server will send a ping whenever the source code is rebuilt.
On starting the server, the browser will automatically open at http://localhost:8000
.
First, you can add a serve
script to package.json. This will run Server.js inside a util folder.
In the below example, we create a function that's responsible for looping through an array. At each traversal, if we've reached the end of the array, we return x. Otherwise, we call the function again with i
incremented, and with x
added with the value of the array at index i
.
function sum(arr, i = 0, x = 0) {
return i === arr.length
? x
: sum(arr, i + 1, x + arr[i]);
}
The following statement creates a MySQL table Products only if it doesn't yet exist. If the table does already exist, then the statement will do nothing.
CREATE TABLE IF NOT EXISTS Products (
product_id int,
low_fats ENUM('Y', 'N'),
recyclable ENUM('Y', 'N')
);
The following statement creates a table Products that contains three columns: product_id, low_fats, and recyclable.
While product_id is of type int
, both low_fats and recyclable are enums that can only be one of the declared values within the ENUM()
clause ('Y'
or 'N'
, in this case).
CREATE TABLE Products (
product_id int,
low_fats ENUM('Y', 'N'),
Let's say we have a SQL schema like this:
Create table If Not Exists Tweets(tweet_id int, content varchar(50));
Truncate table Tweets;
insert into Tweets (tweet_id, content) values ('1', 'Vote for Biden');
insert into Tweets (tweet_id, content) values ('2', 'Let us make America great again!');