Click to show TOC

# Example of Modularizaion

I am going to see how to modularize a try example into multiple files.

While we are here we can demonstrate how to display data, amd show how to incorporate into a new file (in a sub directory modular)

## Displying data

The simplest way of displaying data is to end the script with a expression that returns a value that is not undefined.

let arr = [0, 1, 2, 3, 4, 'hello']; arr.slice(2, 5);

## Displaying and may values

If we need to display display and other points of the script at ponts other than at the end, we need a display function, for example console.log

- $$.D(exp1,exp2…) Display Javascript expression results
- $$.HTML(str) Display string as HTML
- $$.json(expr) Display data as JSON string

### Displaying Javascript Data $$.D

First we will use the $$.D to display Javascript expressions. This function is very similar to console.log(expr1, expr2)

let name = "TryITjs" $$.D('Name: ', name); // display the naame and give it a description let jobTitle = "Developer"; $$.D('Job Title', jobTitle); let arr = [0, 1, 2, 3, 4, 'hello']; $$.D(arr);

### Displaying HTML from string

Here we will show how to render some HTML. In order to support remdering, TryITjs uses Semantic-UI

Page - 1
Executing previous dependent scripts
Waiting to execute