File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 2828| [ clojurescript - hello] ( ./examples/clojurescript/hello.html ) | |
2929| [ coffeescript - tutorial] ( ./examples/coffeescript/tutorial ) | |
3030| [ Create React App - (jsx, flow)] ( ./examples/my-app/build ) | |
31+ | [ JS in HTML] ( ./examples-js-in-html.html ) | A webpage with several inline scripts |
3132| [ asm.js] ( ./examples/asm.html ) | |
3233| [ wasm] ( ./examples/wasm/fib/fib.index.html ) ||
3334
Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < script type ="text/javascript ">
4+ var globalObject = {
5+ first : 'name' ,
6+ last : 'words' ,
7+ } ;
8+ function sayHello ( name ) {
9+ return `Hello, ${ name } !` ;
10+ }
11+ </ script >
12+ < style >
13+ BODY {
14+ font-size : 48px ;
15+ color : rebeccapurple;
16+ }
17+ </ style >
18+ </ head >
19+ < body >
20+ < h1 > Testing Script Tags in HTML</ h1 >
21+ < script >
22+ const capitalize = name => {
23+ return name [ 0 ] . toUpperCase ( ) + name . substring ( 1 ) ;
24+ } ;
25+ const greetAll = [ 'my friend' , 'buddy' , 'world' ]
26+ . map ( capitalize )
27+ . map ( sayHello )
28+ . join ( '\n' ) ;
29+
30+ globalObject . greetings = greetAll ;
31+ </ script >
32+ < p >
33+ Some arbitrary intermediate content to affect the offsets of the scripts
34+ </ p >
35+ < script >
36+ ( function iife ( ) {
37+ const greeting = sayHello ( 'Ryan' ) ;
38+ console . log ( greeting ) ;
39+ } ) ( ) ;
40+ </ script >
41+ </ body >
42+ </ html >
You can’t perform that action at this time.
0 commit comments