File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11JAGL - Just a Golf Language< br >
22< input type ="text " placeholder ="code " id ="c ">
33< input type ="text " placeholder ="input " id ="i "> < br >
4- output:< p id ="out "> </ p >
4+ output:< p id ="o "> </ p >
55< input type ="button " value ="Execute " onclick ="ce() "> < br >
66< script >
77function ce ( ) {
8- c = document . getElementById ( "c" ) . value ;
9- i = document . getElementById ( "i" ) . value ;
10- o = [ ]
11- alert ( c + ", " + i )
8+ c = document . getElementById ( "c" ) . value
9+ i = document . getElementById ( "i" ) . value
10+ c = [ ...c ] ; i = [ ...i ] ; o = [ ] ; ip = 0 ; m = 0 ; t = ""
11+ while ( c . length > ip ) {
12+ if ( c [ 0 ] == "@" ) { m = 1 }
13+ if ( m == 1 ) { if ( c != "@" ) { o . push ( c [ 0 ] ) } ; if ( c == "@" ) { m = 1 ; o . shift ( ) } }
14+ c . shift ( ) }
15+ while ( o . length > 0 ) { t = o [ 0 ] + o [ 1 ] ; c . shift ( ) ; c . shift ( ) ; c . reverse ( ) ; c . push ( t ) ; c . reverse }
16+ document . getElementById ( "o" ) . innerHTML = o ;
1217 }
1318</ script >
You can’t perform that action at this time.
0 commit comments