Skip to content
Open

a #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
3 changes: 2 additions & 1 deletion 01_JS_Basics/Ch1_pgm_01.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Using console.log to display information

console.log("Hello World!");
console.log("your program");
console.log("my program");


/* Further Adventures
Expand Down
2 changes: 2 additions & 0 deletions 02_JS_variables/Ch2_pgm_01.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Declaring a variable

var score;
var variable1;
var variable2;

/* Further Adventures
*
Expand Down
7 changes: 6 additions & 1 deletion 02_JS_variables/Ch2_pgm_02.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

var score;
score = 100;
console.log(score);
score=200;
console.log(score);
score=300;
console.log(score);

/* Further Adventures
*
Expand All @@ -17,7 +22,7 @@ score = 100;
* 3) Type the word score to match your variable name
* and press enter.
* 100, the value assigned to score, should be displayed.
*
*
* 4) Change the value of score in the code above.
* Repeat steps 1, 2 and 3.
*
Expand Down
5 changes: 5 additions & 0 deletions 02_JS_variables/Ch2_pgm_03.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
var score;
score = 100;
console.log(score);
score = 1004
console.log(score);
var score2;
score2 = 190;
console.log(score2);



Expand Down
7 changes: 5 additions & 2 deletions 02_JS_variables/Ch2_pgm_04.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ console.log(score);
score = 150;
console.log(score);



var score2;
score2 = 190;
console.log(score2);
score2 = 277;
console.log(score2);
/* Further Adventures
*
* 1) Change the value assigned to score.
Expand Down
8 changes: 8 additions & 0 deletions 02_JS_variables/Ch2_pgm_05.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ console.log(message);
message = 'Congratulations! Your tweet has won a prize...';
console.log(message);

message = "Thank You!";
console.log(message);

message = "Hello " + "World!";
console.log(message)
message = 'Congratulations!' + ' Your' + ' tweet has won a prize...';
console.log(message);



/* Further Adventures
Expand Down
4 changes: 3 additions & 1 deletion 02_JS_variables/Ch2_pgm_06.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ playerName = "Lionel Messi";
locationName = "Argentina";

console.log(playerName + " is in " + locationName);

var score;
score = 100;
console.log(playerName + " has a score of " + score);


/* Further Adventures
Expand Down
7 changes: 4 additions & 3 deletions 02_JS_variables/Ch2_pgm_07.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

var playerName = "Kandra";
var locationName = "The Dungeon of Doom";

console.log(playerName + " is in " + locationName);


var health = 50;
console.log(playerName + " has health " + health + " and is in " + locationName);
var message = playerName + " has health " + health + " and is in " + locationName;
console.log(message);

/* Further Adventures
*
Expand Down
6 changes: 6 additions & 0 deletions 02_JS_variables/Ch2_pgm_08.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ console.log("New score: " + score);

console.log("Way to go!");

// Further adventures
console.log("Successful splat of a kumquat!");
score = score + 100;
console.log("New score: " + score);
console.log("Congratulations!");



/* Further Adventures
Expand Down
5 changes: 0 additions & 5 deletions 02_JS_variables/Ch2_pgm_09.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ var _underscore56;
var StartWithCapital;
var z5;

var 999;
var 39Steps;
var &nope;
var single words only;
var yield;



Expand Down
33 changes: 33 additions & 0 deletions 03_JS_Objects/Ch3_pgm_01.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@ bookAuthor = "J. R. R. Tolkien";

console.log(bookTitle + " by " + bookAuthor);

// Book-2
var bookTitle2;
var bookAuthor2;

bookTitle2 = "Four Stars of Destiny";
bookAuthor2 = "General Manoj Mukund Naravane";

console.log(bookTitle2 + " by " + bookAuthor2);

// Book-3
var bookTitle3;
var bookAuthor3;

bookTitle3 = "Spare";
bookAuthor3 = "J. R. Moehringer";
console.log(bookTitle3 + " by " + bookAuthor3);

// Book-4
var bookTitle4;
var bookAuthor4;

bookTitle4 = "Victory City";
bookAuthor4 = "Salman Rushdie";
console.log(bookTitle4 + " by " + bookAuthor4);

// Book-5
var bookTitle5;
var bookAuthor5;

bookTitle5 = "As Good As My Word";
bookAuthor5 = "KM Chandrashekhar";
console.log(bookTitle5 + " by " + bookAuthor5);



/* Further Adventures
Expand Down
11 changes: 11 additions & 0 deletions 03_JS_Objects/Ch3_pgm_02.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ console.log(book1Title + " by " + book1Author);
console.log(book2Title + " by " + book2Author);
console.log(book3Title + " by " + book3Author);

// Adding Book-4

bookTitle4 = "Victory City";
bookAuthor4 = "Salman Rushdie";

console.log("There are four books so far...");
console.log(book1Title + " by " + book1Author);
console.log(book2Title + " by " + book2Author);
console.log(book3Title + " by " + book3Author);
console.log(bookTitle4 + " by " + bookAuthor4);



/* Further Adventures
Expand Down
23 changes: 23 additions & 0 deletions 03_JS_Objects/Ch3_pgm_03.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,29 @@ book = {

console.log(book);

// Changing the title of the book

var book;

book = {
title : "The Hobbit, or There and Back Again",
author : "J. R. R. Tolkien",
published : 1937
};

console.log(book);

// Adding Book-2 object
var book;

book2 = {
title : "Let us Dream",
author : "Pope Francis",
published : 2020
};

console.log(book2);



/* Further Adventures
Expand Down
8 changes: 8 additions & 0 deletions 03_JS_Objects/Ch3_pgm_04.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
var book;

book = {};
// Console book
console.log(book);

// Adding extra empty lines
book = {


};
console.log(book);

/* Further Adventures
*
Expand Down
10 changes: 10 additions & 0 deletions 03_JS_Objects/Ch3_pgm_05.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ var book;
book = {
title : "The Hobbit"
};
// console book
console.log(book);

// Book-2
var book2;

book2 = {
title : "Let us Dream"
};
// console book-2
console.log(book2);


/* Further Adventures
Expand Down
7 changes: 7 additions & 0 deletions 03_JS_Objects/Ch3_pgm_06.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Using a variable as a property value

var book;
var book;
var bookName;

Expand All @@ -9,6 +10,12 @@ book = {
title : bookName
};

// Changing the value for bookName
bookName = "Victory City";

book = {
title : bookName
};


/* Further Adventures
Expand Down
10 changes: 7 additions & 3 deletions 03_JS_Objects/Ch3_pgm_07.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ var book2;

book1 = {
title : "The Hobbit",
author : "J. R. R. Tolkien"
author : "J. R. R. Tolkien",
year : 1837 //Add third property
};

book2 = {
title : "Northern Lights",
author : "Philip Pullman"
author : "Philip Pullman",
year : 1902 //Add third property
};

//Console both book objects
console.log(book1);
console.log(book2);


/* Further Adventures
Expand Down
14 changes: 14 additions & 0 deletions 03_JS_Objects/Ch3_pgm_08.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ book = {

console.log(book.title);
console.log(book.author);
// console published property
console.log(book.published);

// Adding Book-2
var book2;

book2 = {
title : "Let us Dream",
author : "Pope Francis",
published : 2020
};
console.log(book2.title);
console.log(book2.author);
console.log(book2.published);



Expand Down
22 changes: 18 additions & 4 deletions 03_JS_Objects/Ch3_pgm_09.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
// Concatenating string properties

var book1;
var book1;
var book2;

book1 = {
title: "The Hobbit",
author: "J. R. R. Tolkien"
author: "J. R. R. Tolkien",
year: 1937 //Add third property
};

book2 = {
title: "Northern Lights",
author: "Philip Pullman"
author: "Philip Pullman",
year: 1902 //Add third property

};

console.log(book1.title + " by " + book1.author + " in " + book1.year);
console.log(book2.title + " by " + book2.author + " in " + book2.year);
// Adding book-3
var book3
book3 = {
title: "Let us Dream",
author: "Pope Francis",
year: 2020 //Add third property

};

console.log(book1.title + " by " + book1.author);
console.log(book2.title + " by " + book2.author);
console.log(book3.title + " by " + book3.author + " in " + book3.year);



Expand Down
10 changes: 10 additions & 0 deletions 03_JS_Objects/Ch3_pgm_10.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ player1.attempted = 1;
player1.correct = 1;
player1.score = 50;

console.log(player1);

// Updated the values
player1.attempted = 2;
player1.correct = 3;
player1.score = 100;
player1.name = "Well";

console.log(player1);



/* Further Adventures
Expand Down
Loading