SlideShare une entreprise Scribd logo
1  sur  30
2
3
var iable = 'hello world';
iable = 5;
global_var = 'hello world';
let knowledge = '';
47 + 11;
'47' + '11';
47 + '11';
47 + Number('11');
4
var
let var
5
6
4 * 10 + 2;
4 * (10 + 2);
var i = 3;
iable += i++;
iable = ++i;
7
8
var tru = 1, fals = 0, wtf = 2;
tru || fals;
wtf || fals;
wtf || tru;
tru || wtf;
var tru = 1, fals = 0, wtf = 2;
tru && fals;
wtf && fals;
wtf && tru;
tru && wtf;
9
true
false
10
'any string';
[];
{ };
1;
'';
NaN;
null;
undefined;
11
var one = 1, two = 2,
two_in_words = '2';
one == two;
one != two;
two == two_in_words;
two === two_in_words;
two < one;
two >= two_in_words;
12
13
if (one) console.log('hello noob!') else console.log('wtf');
console.log(true ? 'hello noob!' : 'wtf');
var mind_twist = 'happens' && 'is annoying' ? 'with strange statements' && 'is real terror'
: 'even if your skill' > 9000 || 'you work alone';
mind_twist == "is real terror" ? console.log("hello pro!") : 'wtf';
14
if else if else
if else
15
switch (something) {
case 'really interesting':
alert('wow this case is really interesting!');
break;
case 42:
alert('ok makes sense');
break;
default:
alert('no specific case was evaluated -> default');
break;
}
16
for(var i = 0; i <= 9000; i++) console.log('power level ' + i );
var go_on = true;
while( go_on ) if( Math.random()*6 >= 5 ) go_on = false;
do { // interesting thing
still_interesting ? continue : break;
} while ( i++ < 100 );
17
for while do
do
while
18
var Story = ['this', 'is', 'a story', 'all about', 'how my code', 'got', 'flipped turned
upside down'];
Story[2] + Story[5] + Story[6]; a
var Story2 = [];
Story2.push(Story[0], Story[1], Story[4], Story[5], Story[2]);
console.log(Story2 = Story2.join(' '));
console.log(Story2.split(' '));
Story2.length;
19
split join
20
var myObject = {
sayHello : function() { console.log('hello'); },
myName : ‘gfnork'
};
myObject.sayHello();
console.log(myObject.myName);
21
22
myObject.sayName = function () {
console.log('my name is: ' + this.myName);
};
myObject.sayName();
var testObj = { sayName: myObject.sayName };
testObj.sayName();
23
this
this
this
this
this this
24
var TalkTo = function(person, msg) {
var text = msg + ', ' + person;
console.log(text);
};
TalkTo('Gfnork', 'What’s up');
var TextTo = function(person, msg) {
return = msg + ', ' + person;
};
25
var insult = function () { console.log('idiot!') };
var praise = function () { console.log('good boy!') };
var teacher = function () {
if (Math.random() < 0.5) return insult();
else return praise();
};
teacher();
teacher();
26
27
(function () {
console.log('This output will be printed once!');
})();
var teacher = function () {
var reaction = Math.random() < 0.5 ?
function () { console.log('idiot!') }() :
function () { console.log('good boy!') }();
return reaction;
};
28
29
30

Contenu connexe

Plus de Qiong Wu

node.js workshop- node.js unit testing
node.js workshop- node.js unit testingnode.js workshop- node.js unit testing
node.js workshop- node.js unit testingQiong Wu
 
node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middlewareQiong Wu
 
node.js workshop- node.js basics
node.js workshop- node.js basicsnode.js workshop- node.js basics
node.js workshop- node.js basicsQiong Wu
 
Parallele Softwareentwicklung mit .NET 4.0
Parallele Softwareentwicklung mit .NET 4.0Parallele Softwareentwicklung mit .NET 4.0
Parallele Softwareentwicklung mit .NET 4.0Qiong Wu
 
S N A I L Final Presentation
S N A I L    Final  PresentationS N A I L    Final  Presentation
S N A I L Final PresentationQiong Wu
 
3 Interop Part2
3 Interop Part23 Interop Part2
3 Interop Part2Qiong Wu
 
C# Workshop - File Operations
C# Workshop - File OperationsC# Workshop - File Operations
C# Workshop - File OperationsQiong Wu
 
C# Workshop - Networking
C# Workshop - NetworkingC# Workshop - Networking
C# Workshop - NetworkingQiong Wu
 
C# Workshop - Threading
C# Workshop - ThreadingC# Workshop - Threading
C# Workshop - ThreadingQiong Wu
 
Life In Power Point
Life In Power PointLife In Power Point
Life In Power PointQiong Wu
 

Plus de Qiong Wu (12)

node.js workshop- node.js unit testing
node.js workshop- node.js unit testingnode.js workshop- node.js unit testing
node.js workshop- node.js unit testing
 
node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middleware
 
node.js workshop- node.js basics
node.js workshop- node.js basicsnode.js workshop- node.js basics
node.js workshop- node.js basics
 
Parallele Softwareentwicklung mit .NET 4.0
Parallele Softwareentwicklung mit .NET 4.0Parallele Softwareentwicklung mit .NET 4.0
Parallele Softwareentwicklung mit .NET 4.0
 
S N A I L Final Presentation
S N A I L    Final  PresentationS N A I L    Final  Presentation
S N A I L Final Presentation
 
3 Interop Part2
3 Interop Part23 Interop Part2
3 Interop Part2
 
Kickoff
KickoffKickoff
Kickoff
 
2 Interop
2 Interop2 Interop
2 Interop
 
C# Workshop - File Operations
C# Workshop - File OperationsC# Workshop - File Operations
C# Workshop - File Operations
 
C# Workshop - Networking
C# Workshop - NetworkingC# Workshop - Networking
C# Workshop - Networking
 
C# Workshop - Threading
C# Workshop - ThreadingC# Workshop - Threading
C# Workshop - Threading
 
Life In Power Point
Life In Power PointLife In Power Point
Life In Power Point
 

Dernier

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 

Dernier (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 

JavaScript code snippets analysis

  • 1.
  • 2. 2
  • 3. 3 var iable = 'hello world'; iable = 5; global_var = 'hello world'; let knowledge = ''; 47 + 11; '47' + '11'; 47 + '11'; 47 + Number('11');
  • 5. 5
  • 6. 6 4 * 10 + 2; 4 * (10 + 2); var i = 3; iable += i++; iable = ++i;
  • 7. 7
  • 8. 8 var tru = 1, fals = 0, wtf = 2; tru || fals; wtf || fals; wtf || tru; tru || wtf; var tru = 1, fals = 0, wtf = 2; tru && fals; wtf && fals; wtf && tru; tru && wtf;
  • 11. 11 var one = 1, two = 2, two_in_words = '2'; one == two; one != two; two == two_in_words; two === two_in_words; two < one; two >= two_in_words;
  • 12. 12
  • 13. 13 if (one) console.log('hello noob!') else console.log('wtf'); console.log(true ? 'hello noob!' : 'wtf'); var mind_twist = 'happens' && 'is annoying' ? 'with strange statements' && 'is real terror' : 'even if your skill' > 9000 || 'you work alone'; mind_twist == "is real terror" ? console.log("hello pro!") : 'wtf';
  • 14. 14 if else if else if else
  • 15. 15 switch (something) { case 'really interesting': alert('wow this case is really interesting!'); break; case 42: alert('ok makes sense'); break; default: alert('no specific case was evaluated -> default'); break; }
  • 16. 16 for(var i = 0; i <= 9000; i++) console.log('power level ' + i ); var go_on = true; while( go_on ) if( Math.random()*6 >= 5 ) go_on = false; do { // interesting thing still_interesting ? continue : break; } while ( i++ < 100 );
  • 18. 18 var Story = ['this', 'is', 'a story', 'all about', 'how my code', 'got', 'flipped turned upside down']; Story[2] + Story[5] + Story[6]; a var Story2 = []; Story2.push(Story[0], Story[1], Story[4], Story[5], Story[2]); console.log(Story2 = Story2.join(' ')); console.log(Story2.split(' ')); Story2.length;
  • 20. 20 var myObject = { sayHello : function() { console.log('hello'); }, myName : ‘gfnork' }; myObject.sayHello(); console.log(myObject.myName);
  • 21. 21
  • 22. 22 myObject.sayName = function () { console.log('my name is: ' + this.myName); }; myObject.sayName(); var testObj = { sayName: myObject.sayName }; testObj.sayName();
  • 24. 24 var TalkTo = function(person, msg) { var text = msg + ', ' + person; console.log(text); }; TalkTo('Gfnork', 'What’s up'); var TextTo = function(person, msg) { return = msg + ', ' + person; };
  • 25. 25 var insult = function () { console.log('idiot!') }; var praise = function () { console.log('good boy!') }; var teacher = function () { if (Math.random() < 0.5) return insult(); else return praise(); }; teacher(); teacher();
  • 26. 26
  • 27. 27 (function () { console.log('This output will be printed once!'); })(); var teacher = function () { var reaction = Math.random() < 0.5 ? function () { console.log('idiot!') }() : function () { console.log('good boy!') }(); return reaction; };
  • 28. 28
  • 29. 29
  • 30. 30