EN - JavaScript
JavaScript is a scripts programming language, intended for interactive Web pages and for App. Web too, created in 1995. JavaScript is an object oriented language, known as prototype.
JavaScript is a scripts programming language, intended for interactive Web pages and for App. Web too, created in 1995. JavaScript is an object oriented language, known as prototype. BEGINNER ⇒ Code Examples → You must be bilingual (Fr/En). Code examples are in English. → Let's start with very simple codes. The more you progress, page after page, the more sophisticated the scripts will be. However, you must go over 30 to 40 pages per level, before moving on to the next step... → In order to evaluate your codes, click on the icon on the left at the bottom of the page (gears), then choose a compiler from the list that will be open in another tab. Finally, test your work. NOW REPRODUCE AND IMMERSE YOURSELF! C 0001 - Hello World ! Reproduce this code (do not copy and paste!). <!DOCTYPE html> < html > < body > < h2 > Exemple </ h2 > < p id = "example1" > JavaScript can change content </ p > < button type = "button" onclick = 'document.getElementById("example1").innerHTML = "Hello World !";' > Click here ! </ button > </ body > </ html > C 0002 - List Reproduce this code (do not copy and paste!). <!DOCTYPE html> < html > < body > < h2 >Array methods using JavaScript </ h2 > < h2 > join() </ h2 > < p >The join () method joins the array elements into a string. </ p > < p >In this example, "/" acts as a separator between the elements presented : </ p > < p id = "demo" ></ p > < script > const painters = [ "Vermeer" , "Picasso" , "Leonardo da Vinci" , "Vincent van Gogh" ]; document . getElementById ( "demo" ). innerHTML = painters . join ( " / " ); </ script > </ body > </ html > C 0003 - PopUp Reproduce this code (do not copy and paste!). <!DOCTYPE html> < html > < body > < h2 > POPUP </ h2 > < p > Example </ p > < script > window . alert ( 189 + 3454 ); </ script > </ body > </ html > C 0004 - Data Comparison Reproduce this code (do not copy and paste!). <!DOCTYPE html> < html > < body > < h2 >Compare two data for your retirement </ h2 > < p >Indicate your age : </ p > < input id = "age" value = "67" /> < button onclick = "myFunction()" > Compare </ button > < p id = "demo" ></ p > < script > function myFunction () { let age = document . getElementById ( "age" ). value ; let see = ( age < 67 ) ? "Too young ":"Old enough " ; document . getElementById ( "demo" ). innerHTML = see + "to retire ." ; } </ script > </ body > </ html > C 0005 - Data Types Reproduce this code (do not copy and paste!). <!DOCTYPE html> <html> <body> <h2>Evaluation</h2> <p id="comp"></p> <script> let x = 6 + 28 + "Orange" + "Paris" ; document.getElementById("comp").innerHTML = x; </script> </body> </html> C 0006 - Data Types Reproduce this code (do not copy and paste!). <!DOCTYPE html> <html> <body> <h2>Evaluation</h2> <p id="comp"></p> <script> let x = 134 + "Blue" + 272 + "Orange" + "London" ; document.getElementById("comp").innerHTML = x; </script> </body> </html> C 0007 - Data Types Reproduce this code (do not copy and paste!). <!DOCTYPE html> <html> <body> <h2>Evaluation</h2> <p id="comp"></p> <script> let x = 134 + " Blue" + 272 + " Orange" + " London" ; document.getElementById("comp").innerHTML = x; </script> </body> </html> C 0008 - PopUp Reproduce this code (do not copy and paste!). <!DOCTYPE html> < html > < body > < h2 > POPUP </ h2 > < p > Example </ p > < script > window . alert ( 888 + 2023 ); </ script > </ body > </ html > The comments you leave us are systematically subject to rigorous moderation. Incivility and slander, threats, intimidation of all kinds, more generally all gratuitous verbal violence, or the dissemination of unverified information... are not tolerated. We also reserve the right to publish only comments which effectively advance the debate and allow a better understanding of the subject covered by the article presented on this page (as well as all its ramifications) and this, whatever its overall content.