parent
ffd79e248d
commit
905b08a2e3
@ -0,0 +1,7 @@
|
|||||||
|
// comments can make code readable
|
||||||
|
// Welcome to 30DaysOfJavaScript
|
||||||
|
|
||||||
|
/*
|
||||||
|
comments can make code readable,
|
||||||
|
easy to reuse and informative
|
||||||
|
*/
|
@ -0,0 +1,5 @@
|
|||||||
|
console.log(typeof studentName);
|
||||||
|
console.log(typeof learning);
|
||||||
|
console.log(typeof age);
|
||||||
|
console.log(typeof score);
|
||||||
|
console.log(typeof grade);
|
@ -0,0 +1,28 @@
|
|||||||
|
// Create a variable.js file and declare variables and assign string, boolean, undefined and null data types
|
||||||
|
|
||||||
|
let newStudentName = "Mujeeb ur Rahman";
|
||||||
|
let learning = true;
|
||||||
|
let newAge = 25;
|
||||||
|
let score;
|
||||||
|
let grad = null;
|
||||||
|
|
||||||
|
let firstVariable;
|
||||||
|
let secondVariable;
|
||||||
|
let thirdVariable;
|
||||||
|
let fourthVariable;
|
||||||
|
|
||||||
|
let fifthVariable = "fifthVariable";
|
||||||
|
let sixthVariable = 6;
|
||||||
|
let seventhVariable = true;
|
||||||
|
let eighthVariable = 8.0;
|
||||||
|
|
||||||
|
let myFirstName = "Mujeeb ur",
|
||||||
|
myLastName = "Rahman",
|
||||||
|
materialStatus = "single",
|
||||||
|
myCountry = "Pakistan",
|
||||||
|
myAge = 30;
|
||||||
|
|
||||||
|
let yourAge = 25;
|
||||||
|
|
||||||
|
console.log(`I am ${myAge} years old`);
|
||||||
|
console.log(`You are ${yourAge} years old`);
|
@ -1,19 +1,18 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>30DaysOfJavaScript</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<title>30DaysOfJavaScript</title>
|
<h1>30DaysOfJavaScript:03 Day</h1>
|
||||||
</head>
|
<h2>Introduction</h2>
|
||||||
|
<button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button>
|
||||||
<body>
|
<script src="./helloworld.js"></script>
|
||||||
<h1>30DaysOfJavaScript:03 Day</h1>
|
<script src="./introduction.js"></script>
|
||||||
<h2>Introduction</h2>
|
<script src="./variable.js"></script>
|
||||||
<button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button>
|
<script src="./main.js"></script>
|
||||||
<script src="./helloworld.js"></script>
|
<script src="./day1_solution/variable.js"></script>
|
||||||
<script src="./introduction.js"></script>
|
<script src="./day1_solution/datatypes.js"></script>
|
||||||
<script src="./variable.js"></script>
|
</body>
|
||||||
<script src="./main.js"></script>
|
</html>
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// the variable values can be accessed from other variable.js file
|
// the variable values can be accessed from other variable.js file
|
||||||
console.log(firstName, lastName, country, city, age, isMarried)
|
console.log(firstName, lastName, country, city, age, isMarried);
|
||||||
console.log(gravity, boilingPoint, PI) // 9.81, 100, 3.14
|
console.log(gravity, boilingPoint, PI); // 9.81, 100, 3.14
|
||||||
console.log(name, job, live)
|
console.log(name, job, live);
|
||||||
|
console.log(studentName, studentJob, studentLive);
|
||||||
|
@ -1,20 +1,24 @@
|
|||||||
// Declaring different variables of different data types
|
// Declaring different variables of different data types
|
||||||
|
|
||||||
let firstName = 'Asabeneh' // first name of a person
|
let firstName = "Asabeneh"; // first name of a person
|
||||||
let lastName = 'Yetayeh' // last name of a person
|
let lastName = "Yetayeh"; // last name of a person
|
||||||
let country = 'Finland' // country
|
let country = "Finland"; // country
|
||||||
let city = 'Helsinki' // capital city
|
let city = "Helsinki"; // capital city
|
||||||
let age = 100 // age in years
|
let age = 100; // age in years
|
||||||
let isMarried = true
|
let isMarried = true;
|
||||||
|
|
||||||
// Declaring variables with number values
|
// Declaring variables with number values
|
||||||
|
|
||||||
const gravity = 9.81 // earth gravity in m/s2
|
const gravity = 9.81; // earth gravity in m/s2
|
||||||
const boilingPoint = 100 // water boiling point, temperature in oC
|
const boilingPoint = 100; // water boiling point, temperature in oC
|
||||||
const PI = 3.14 // geometrical constant
|
const PI = 3.14; // geometrical constant
|
||||||
|
|
||||||
// Variables can also be declaring in one line separated by comma
|
// Variables can also be declaring in one line separated by comma
|
||||||
|
|
||||||
let name = 'Asabeneh', //name of a person
|
let name = "Asabeneh", //name of a person
|
||||||
job = 'teacher',
|
job = "teacher",
|
||||||
live = 'Finland'
|
live = "Finland";
|
||||||
|
|
||||||
|
let studentName = "Mujeeb ur Rahman",
|
||||||
|
studentJob = "software learner",
|
||||||
|
studentLive = "Pakistan";
|
||||||
|
Loading…
Reference in new issue