SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

Más 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
 

Último

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Último (20)

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

node.js workshop- JavaScript Basics

  • 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