-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (27 loc) · 739 Bytes
/
Copy pathindex.js
File metadata and controls
35 lines (27 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// example 1 - variable declaration
const foo = "bar";
// example 2 - nested variable declaration
const someObject = {
data: {
data: {
foo: "bar",
},
},
};
// example 3 - single statement
console.log("hello world");
// example 4 - multi arg
console.log(foo, "hello", 6);
// example 5 - accessing nested data
const value = someObject.data.data.foo;
// example 6 - accessing nested data when not sure
const unknownValue = someObject?.data?.data?.foo;
// example 7 - defining functions
function basicFunction() {
// hello
return value;
}
// example 8 - import and default import
const fs = require("fs");
// example 9 - import and default import
// import React, { useState } from "react";