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

Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 

Dernier (20)

Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 

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