Single Page Application (SPA)

Functional Programming in JavaScript

Array Methods

// array of numbers
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

// get square of each number
const squares = numbers.map((number) => number ** 2)

Function Reference

// here function1 is a function reference
// to the function body
function function1() {
  console.log('inside function1')
}

Export and Import

Named Export

// App.jsx
export function App() {
  // ...
}

// main.jsx
// importing with same name as exported entity
import {App} from './App.jsx'

// importing with an alias
import {App as MyApp} from './App.jsx'

Default Export