Skip to content
Open
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
38 changes: 38 additions & 0 deletions calculator app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Calculator App</title>
</head>
<body>
<div class="main">
<input type="text" id="input">
<div class="first-div">
<button class="item">7</button>
<button class="item">8</button>
<button class="item">9</button>
<button class="item">-</button>
</div>
<div class="second-div">
<button class="item">4</button>
<button class="item">5</button>
<button class="item">6</button>
<button class="item">+</button>
</div>
<div class="third-div">
<button class="item">1</button>
<button class="item">2</button>
<button class="item">3</button>
<button class="item">/</button>
</div>
<div class="last-div">
<button class="item">0</button>
<button class="item">X</button>
<button class="item" id="total">=</button>
<button class="item">.</button>
</div>
</div>
</body>
</html>
9 changes: 9 additions & 0 deletions calculator app/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const input = document.getElementById('input');
const total = document.getElementById('total')
const figure = document.querySelector('.item')
const btn =document.querySelector('button')


btn.addEventListener('click',()=>{
console.log('working')
})
35 changes: 35 additions & 0 deletions calculator app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
body{
background: darksalmon;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif ;
font-size: 20px;
}
.main{
display: flex;
flex-direction: column;
}
.first-div{
display: flex;
justify-content: center;
}
.second-div{
display: flex;
justify-content: center;
}
.third-div{
display: flex;
justify-content: center;
}
.last-div{
display: flex;
justify-content: center;
}
.item{
background: #fff;
border: 1px solid red;
padding: 3rem;
}
#input{
padding: 3rem;
width: 21%;
margin:0rem auto;
}
2 changes: 1 addition & 1 deletion week 5/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JS-Intro-OOP-Exercises
# JS-Intro-OOP-Exercises

# Exercises

Expand Down
19 changes: 19 additions & 0 deletions week 5/book-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

class Book{
constructor(title,genre,author,read,date){
this.title = title;
this.genre = genre;
this.author = author;
this.read = read;
this.date = date
}
}

class BookList extends Book{
constructor(title,genre,author,read,date){
super(title,genre,author,read,date)
}
finishCurrentBook(){
console.log()
}
}
19 changes: 19 additions & 0 deletions week 5/virtual-cat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const kitty = {
tiredness (){
console.log('kitty wants to sleep')
},
hunger (){
console.log('kitty needs to be fed')
console.log('kitty does not want to eat')
},
lonliness(){
console.log('kitty wants to be petted')
},
happiness(){
console.log('kitty is very happy')
}
}
kitty.tiredness()
kitty.hunger()
kitty.lonliness()
kitty.happiness()
35 changes: 35 additions & 0 deletions week-6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# JS Closures exercises (MVP)

1. In your own terms, define what a Closure is in Javascript

2. What is result?

```
var a = 1;

function someFunction(number) {
function otherFunction(input) {
return a;
}

a = 5;

return otherFunction;
}

var firstResult = someFunction(9);
var result = firstResult(2);
```

3. What will you see in the console for the following example? Explain Why

```
var a = 1;
function b() {
a = 10;
return;
function a() {}
}
b();
console.log(a);
```
34 changes: 34 additions & 0 deletions week-6/closures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 1. In your own terms, define what a Closure is in Javascript


// Closure is a combination of nested function with it's surrounding states(the scopes). Closures allows functions access varibles that are declared globally.


// 2. What is result?
var a = 1;

function someFunction(number) {
function otherFunction(input) {
return a;
}

a = 5;

return otherFunction;
}

var firstResult = someFunction(9);
var result = firstResult(2);

// answer: 2

// 3. What will you see in the console for the following example? Explain Why
var a = 1;
function b() {
a = 10;
return;
function a() {}
}
b();
console.log(a);
// Answer: 10 should be logged to the console because variable was reassigned within the function(although my console is giving another answer)