1 / 11

Being Awesome with Javascript and Jquery

Being Awesome with Javascript and Jquery. A tutorial by Zoe F. <Html> <head> <script> I am some inline javascript </script> <script src =I am a link to an external javascript file.js> </head> <body> <a href = I am some built-in javascript >Text</a> </html.

raleigh
Download Presentation

Being Awesome with Javascript and Jquery

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Being Awesome with Javascript and Jquery A tutorial by Zoe F

  2. <Html> <head> <script> I am some inline javascript </script> <script src=I am a link to an external javascript file.js> </head> <body> <a href = I am some built-in javascript>Text</a> </html

  3. Variables • Strings: • var a = "I am a string"; • var b = 'So am I!'; • Numbers: • var num1 = 100; • var num2 = 100.10; • var num3 = 0.10; • Booleans • var okay = true; • var fail = false; • Objects, arrays, functions

  4. Comparisions var foo = 1; var bar = 0; varbim = 2; foo == bar; // console would output false foo != bar; // true foo >bim; // false foo <= bim;//true

  5. Boolean Logic var foo = 1; var bar = 0; // returns 1, which is true foo || bar; // returns 0, which is false foo && bar;

  6. If/Thens if (thing you want to evaluate to true or false) { // The code in here will run. } else { // the code in here will run if the above is false. }

  7. An easier if/then statement: Switch switch ( foo ) { case "bar": alert( "the value was bar -- yay!" ); break; case "baz": alert( “It was baz:(" ); break; default: alert( “It wasnt either of those" ); }

  8. For loops for ( [initialization]; [conditional]; [iteration] ) { [loopBody] } for ( vari = 0; i < 5; i++ ) { // Logs "try 0", "try 1", ..., "try 4". console.log( "try " + i); }

  9. while ( [conditional] ) { [loopBody] } vari = -1; while ( ++i < 100 ) { //this is the same as writing “while ((i=i+1)<100)” // This block will be executed 100 times. console.log( "Currently at " + i ); }

  10. Functions Function buyOranges() { Find some oranges Bring them to me }; Function buyOranges(amount, maxCost) { Find some oranges Choose amountof them If they are less than maxCost, bring them to me }; buyOranges(5, 20); //Buy me 5 oranges if it’s less than $20

  11. Jquery:It’s just another bunch of functions Reference: http://www.w3schools.com/jquery/default.asp

More Related