Getting Started with Programming

I Getting to know you

i. What is your name? 1/28

"Sunakshi"

ii. Discover the length 2/28

"Sunakshi".length

iii.Basic math 3/28

5 + 6;

iv. Numbers and more 4/28

5/6

v. Error: does not compute! 5/28

cucumber

II Why learn programming?
i. Editor and comments 6/28

"cake".length;

ii. What am I learning? 7/28
Save and Submit
iii. Interactive JavaScript 8/28

confirm("Do you want to submit?")

iv. What is programming? 9/28

prompt("Where are you from?");

v. Data Types I & II: Numbers & Strings 10/28

"hello whats up"
"hello whats up".length

vi. Data Type III: Booleans 11/28

"I'm coding like a champ".length > 10

III Make the computer think!
i. Using console.log 12/28

console.log(2 * 5)
console.log("Hello")

ii. Comparisons 13/28

console.log(15 > 4); 
console.log("Xiao Hui".length  8);
console.log(8*2 == 16);

iii. Decisions, decisions 14/28

if ("nonu".length < 8 ) {
    console.log( "I am Saksham" );
} 

iv. Computers are smart 15/28

if ( "Sunakshi".length <= 7) 
{
    console.log("Let's go down the first road!");
}
else 
{
    console.log("Your name is long") 

v. More practice with conditionals 16/28

if (5 * 4 >= 50)
{
    console.log("The condition is true")
}
else
{
    console.log("The condition is false")
}
 

vi. Computers aren’t that smart 17/28

 if (10 == 10) 
{
    console.log("You got a true!");
} 
else 
{
    console.log("You got a false!");
}

IV Playing with strings and numbers
i. Mid-lesson breather 18/28

if (12 / 4 == "Ari".length) {
    confirm("Will this run the first block?");
} else {
    confirm("Or the second block?");
} 

ii. Math 19/28

if ("Jon".length * 2 === (2+4)  )
{
    console.log("The answer makes sense!");
} 
else 
{
    console.log("Error Error Error");
}
 

iii. Math and the modulo 20/28

console.log(14 % 3) 
console.log(99 % 8) 
console.log(11 % 3)  

iv. Modulo and if / else 21/28

 if( 12 % 4 === 0 ) {
    console.log("The first number is even");
} else {
    console.log("The first number is odd");
}

v. Substrings 22/28

 "wonderful day".substring(3,7);

vi. More substring practice 23/28

console.log( "January".substring(0,3));
console.log( "Melbourne is great".substring(0,12));
console.log( "Hamburgers".substring(3,10));
 

V Variables

i. Variables 24/28

 console.log(myAge);
var myAge = 23;

ii. More Variable Practice 25/28

 var myCountry = "India";
console.log(myCountry.length);
console.log(myCountry.substring(0,3));

iii. Change variable values 26/28

 var myName = "Sunakshi"
console.log(myName);
console.log(myName.substring(0,2));
console.log(myName);

iv. Conclusion: Part 1 27/28

 var myColor = "Orange";
console.log(myColor.length);

v. Conclusion: Part 2 28/28

 if ("saksham".length >= "sunakshi".length)
{
    console.log("I am Sunakshi's little brother");
}
else {
    console.log("I finished my first course!");
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s