Shop

Javascript program: lol -(28/06/12)- screen printout by paulramnora

Photographic Prints

Size:
Finish:
$6.60
Available to buy on…

Javascript program: lol -(28/06/12)- screen printout by 


Table Of Contents:-

1.1 – WHY I DECIDED TO GO WRITE THIS JAVASCRIPT PROGRAM
1.2 – VERY IMPORTANT! WARNING NOTE:
1.3 – EXPLAINING WHAT EACH LINE OF JAVASCRIPT CODE DOES


1.1 – WHY I DECIDED TO GO WRITE THIS JAVASCRIPT PROGRAM

I remember, I decided to type into RedBubble search engine the words: javascript.

I felt very deeply impressed by a few of the example programs that were being shown. Thus, I really couldn’t help but to feel totally ‘inspired’ to go create my own.

The only advantage those other RedBubbler’s have over me…is they know how to make T-shirts; me, I still got to work this out? But, whenever I do, then, woah! There will be a whole lotta code coming… ;-)


1.2 – VERY IMPORTANT! WARNING NOTE:

I would like to quite clearly point out to anyone who is interested in running this javascript web page program source code; that it does, in fact, create an ‘endless loop’; where the program keeps on repeating itself, again and again, ad infinitum.

Which means that you’re web browser software is very highly likely to ‘lock up’, completely; and, therefore, you will have no other choice but to either…

A> Close the web page itself down; which, sometimes, has the effect of closing all other web browser windows/tabs which were already open.

B> Reboot the entire machine in order to get it up and working properly, again; so that you can re-start your web browser software.

Thus, my advice is only attempt running this script if you already know exactly what it is your doing; meaning, know how to close a ‘locked up’ web browser; which, on Windows operating system platforms is combination keypress:

1> [CTRL]’+[ALT]+DEL]
2> chose Task Manager application
3> select which software you wish to close.

Also, please remember to ‘Save’ any work being stored inside of your previously opened web browser windows/tabs, first; before running this script; as if you close down/without initially saving; then, of course, all of your previously entered data will be lost…!


1.3 – EXPLAINING WHAT EACH LINE OF JAVASCRIPT CODE DOES

Now, here is the same Javascript web page source code; with a number of Javascript explanatory comments: //…; being included to explain exactly what each separate line of code does:-

1. <script language="javascript"> //start script block/also, tells web browser which scripting language we wish to use, in this case, “Javascript”

2. <—start hide script, from all those web browsers than don’t understand how to read/interpret scripts

3. var laughter=“lol” //…first, initialise message string to say, “lol”

4. while(laughter){ //…conditional test/the loop block starts here

5. alert(laughter); //…open an alert dialog box/print out message

6>laughter+=laughter; //…add message to itself/thus, create longer message

7>} //…the loop block ends here

8. //—> end hide script

9. </script> <!--end script block-->

The reason why the loop keeps on repeating, endlessly; is due to the loop’s initial test condition; which is seen in line 4…

4. while(laughter){ //conditional test/the loop block starts here

A conditional test can return either of 2 values: ‘true’/or else, ‘false’; also, known as being called: Boolean values; which is a branch of mathematics invented by mathematician, George Boole. I suggest, you can Google his name…; that is, if you really wish to learn more.

What this while loop conditional test statement is saying is, does the variable/memory storage box, called: laughter, contain a value inside of it which says, ‘true’?

In this particular case, the result of the conditional test does, indeed, always return as being, ‘true’; which, in turn, starts the loop repeating itself endlessly, again and again; that is, it repeats whatever code is being written inside the middle of the loop block.

The reason why the conditional test return value is, ‘true’, is due to line 3…
3. var laughter=“lol”;
…where the variable: laughter, gets initialised =, as having some initial value text: “lol”.

If the conditional test had returned as being, ‘false’…; thus, if we were to change line 3 to say…

3. var laughter //…without giving laughter any value to begin with
…or,…
3 var laughter="" //…meaning an empty string with no text inside it
…or,…
3. laughter=null; //…null, means the same as empty string

…then, the loop would not even have gotten started; thus, there would have been absolutely nil ‘output’; as we would never have entered into the middle ‘output’ section of the loop.

Tags

javascript, program, lol, printout, programming, text

NAME: Paul Ramnora
AGE: 49
LOCATION: UK/London (born/brought up/living)
INTERESTS: General Art(s), General Computing/Programming, General Education/-etc.
LEARNING DISABLITIES: ADD/Attention Deficit Disorder, AS/Aspergers Syndrome
NOTE: I’m mostly a self-taught artist. I like all arts: drawing/painting/sculpting/origami/writing/-etc.

View Full Profile

Comments

  • Albert
    Albertabout 2 years ago

    lol

  • Thanks, Albert! ;-)

    – paulramnora

  • Norma-jean Morrison
    Norma-jean Mor...about 2 years ago

    GREAT GOING, YOU WILL WORK THIS OUT, PAUL, I HAVE A GOOD FEELING ALWAYS

  • Thanks! ;-) To tell you the truth, people have already sent me links on how to go and create RedBubble T-Shirts; it’s just that I been to lazy to work my way through it; like I get so far; then, quit. ADD/Attention Deficit Disorder kicks in, again, I suppose; but, yes, I do ‘know’ that eventually I’ll get there; whenever I’m feeling far more fully determined to go try, again.

    – paulramnora

desktop tablet-landscape content-width tablet-portrait workstream-4-across phone-landscape phone-portrait