parent
bcdfea5fd3
commit
74ef9b5d83
@ -0,0 +1,121 @@
|
|||||||
|
# Day 1 - Introduction
|
||||||
|
|
||||||
|
## [< Home >](../README.md) | [Day 2 >>](./02_day_datatype.md)
|
||||||
|
|
||||||
|
### [Exercise Level 1](#exercise-level-1)
|
||||||
|
|
||||||
|
### Exercise Level 1
|
||||||
|
|
||||||
|
1. Write a single line comment which says, _comments can make code readable_
|
||||||
|
2. Write another single comment which says, _Welcome to 30DaysOfJavaScript_
|
||||||
|
3. Write a multiline comment which says, _comments can make code readable, easy to reuse_
|
||||||
|
_and informative_
|
||||||
|
|
||||||
|
4. Create a variable.js file and declare variables and assign string, boolean, undefined and null data types
|
||||||
|
5. Create datatypes.js file and use the JavaScript **_typeof_** operator to check different data types. Check the data type of each variable
|
||||||
|
6. Declare four variables without assigning values
|
||||||
|
7. Declare four variables with assigned values
|
||||||
|
8. Declare variables to store your first name, last name, marital status, country and age in multiple lines
|
||||||
|
9. Declare variables to store your first name, last name, marital status, country and age in a single line
|
||||||
|
10. Declare two variables _myAge_ and _yourAge_ and assign them initial values and log to the browser console.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
I am 25 years old.
|
||||||
|
You are 30 years old.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Exercise Level 1
|
||||||
|
|
||||||
|
|
||||||
|
1. Write a single line comment which says, comments can make code readable
|
||||||
|
|
||||||
|
```js
|
||||||
|
// comments can make code readable
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Write another single comment which says, Welcome to 30DaysOfJavaScript
|
||||||
|
|
||||||
|
```js
|
||||||
|
//Welcome to 30DaysOfJavaScript
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Write a multiline comment which says, comments can make code readable, easy to reuse and informative
|
||||||
|
|
||||||
|
```js
|
||||||
|
/* comments can make code readable,
|
||||||
|
easy to reuse and informative */
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Create a variable.js file and declare variables and assign string, boolean, undefined and null data types
|
||||||
|
|
||||||
|
```js
|
||||||
|
//variable.js
|
||||||
|
let string = 'nevzat'
|
||||||
|
let number = 25
|
||||||
|
let boolean = true
|
||||||
|
let nulll = null
|
||||||
|
let any; //undefined
|
||||||
|
```
|
||||||
|
|
||||||
|
5.Create datatypes.js file and use the JavaScript typeof operator to check different data types. Check the data type of each variable
|
||||||
|
|
||||||
|
```js
|
||||||
|
//variable.js
|
||||||
|
|
||||||
|
let string = 'nevzat'
|
||||||
|
let number = 25
|
||||||
|
let boolean = true
|
||||||
|
let nulll = null
|
||||||
|
let any;
|
||||||
|
|
||||||
|
console.log(typeof (string) ) //String
|
||||||
|
console.log(typeof (number)) //Number
|
||||||
|
console.log(typeof (boolean)) //Boolean
|
||||||
|
console.log(typeof (nulll)) //Object
|
||||||
|
console.log(typeof (any)) //Undefined
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Declare four variables without assigning values
|
||||||
|
|
||||||
|
```js
|
||||||
|
let variable1;
|
||||||
|
let variable2;
|
||||||
|
var variable3;
|
||||||
|
let variable4;
|
||||||
|
```
|
||||||
|
|
||||||
|
7. Declare four variables with assigned values
|
||||||
|
|
||||||
|
```js
|
||||||
|
variable1 = "nevzat"
|
||||||
|
variable2 = "ATALAY"
|
||||||
|
variable3 = true;
|
||||||
|
variable4 = 25;
|
||||||
|
```
|
||||||
|
|
||||||
|
8. Declare variables to store your first name, last name, marital status, country and age in multiple lines
|
||||||
|
|
||||||
|
```js
|
||||||
|
let firstName = "nevzat"
|
||||||
|
let lastName = "atalay"
|
||||||
|
let old = 25
|
||||||
|
let isMarried = true
|
||||||
|
```
|
||||||
|
|
||||||
|
9. Declare variables to store your first name, last name, marital status, country and age in a single line
|
||||||
|
|
||||||
|
```js
|
||||||
|
let name = "nevzat",surName="atalay",age = 25, married = true
|
||||||
|
```
|
||||||
|
|
||||||
|
10. Declare two variables myAge and yourAge and assign them initial values and log to the browser console.
|
||||||
|
|
||||||
|
```js
|
||||||
|
let myAge= 25
|
||||||
|
let yourAge = 22
|
||||||
|
|
||||||
|
console.log("I am " + " " + myAge + " " + "years old.") // I am 25 years old.
|
||||||
|
console.log("You are" + " " + yourAge + " " + "years old.") // You are 22 years old.
|
||||||
|
```
|
||||||
|
|
||||||
|
## [< Home >](../README.md) | [Day 2 >>](./02_day_datatype.md)
|
||||||
@ -1,79 +0,0 @@
|
|||||||
//---------------------------day1_level_1 1.exercise ------------------------\\
|
|
||||||
// Write a single line comment which says, comments can make code readable
|
|
||||||
|
|
||||||
// comments can make code readable
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 2.exercise-------------------------\\
|
|
||||||
// Write another single comment which says, Welcome to 30DaysOfJavaScript
|
|
||||||
|
|
||||||
//Welcome to 30DaysOfJavaScript
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 3.exercise-------------------------\\
|
|
||||||
// Write a multiline comment which says, comments can make code readable, easy
|
|
||||||
// to reuse and informative
|
|
||||||
|
|
||||||
/* comments can make code readable,
|
|
||||||
easy to reuse and informative */
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 4.exercise-------------------------\\
|
|
||||||
// Create a variable.js file and declare variables and assign string, boolean,
|
|
||||||
// undefined and null data types
|
|
||||||
|
|
||||||
//variable.js
|
|
||||||
let string = 'nevzat'
|
|
||||||
let number = 25
|
|
||||||
let boolean = true
|
|
||||||
let nulll = null
|
|
||||||
let any; //undefined
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 5.exercise-------------------------\\
|
|
||||||
// Create datatypes.js file and use the JavaScript typeof operator to check
|
|
||||||
// different data types. Check the data type of each variable
|
|
||||||
|
|
||||||
//type.js
|
|
||||||
console.log(typeof (string) )
|
|
||||||
console.log(typeof (number))
|
|
||||||
console.log(typeof (boolean))
|
|
||||||
console.log(typeof (nulll))
|
|
||||||
console.log(typeof (any))
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 6.exercise-------------------------\\
|
|
||||||
// Declare four variables without assigning values
|
|
||||||
|
|
||||||
let variable1;
|
|
||||||
let variable2;
|
|
||||||
var variable3;
|
|
||||||
let variable4;
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 7. exercise------------------------\\
|
|
||||||
// Declare four variables with assigned values
|
|
||||||
|
|
||||||
variable1 = "nevzat"
|
|
||||||
variable2 = "ATALAY"
|
|
||||||
variable3 = true;
|
|
||||||
variable4 = 25;
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 8.exercise-------------------------\\
|
|
||||||
// Declare variables to store your first name, last name, marital status,
|
|
||||||
// country and age in multiple lines
|
|
||||||
|
|
||||||
let firstName = "nevzat"
|
|
||||||
let lastName = "atalay"
|
|
||||||
let old = 25
|
|
||||||
let isMarried = true
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 9.exercise-------------------------\\
|
|
||||||
// Declare variables to store your first name, last name, marital status,
|
|
||||||
// country and age in a single line
|
|
||||||
|
|
||||||
let name = "nevzat",surName="atalay",age = 25, married = true
|
|
||||||
|
|
||||||
//---------------------------day1_level_1 10.exercise------------------------\\
|
|
||||||
// Declare two variables myAge and yourAge and assign them initial values
|
|
||||||
// and log to the browser console.
|
|
||||||
|
|
||||||
let myAge= 25
|
|
||||||
let yourAge = 22
|
|
||||||
|
|
||||||
console.log("I am " + " " + myAge + " " + "years old.")
|
|
||||||
console.log("You are" + " " + yourAge + " " + "years old.")
|
|
||||||
Loading…
Reference in new issue