Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions Week1/homework/js-exercises/Error debugging.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// console.log('I'm awesome');
// changes single queto to double queto
console.log("I'm awesome");

// or
console.log('I\'m awesome');
console.log('I`m awesome');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This last one is not really correct, because the output would not be the same. the ` is a different character then the '. You already solved the exercise with the first two answers!

7 changes: 7 additions & 0 deletions Week1/homework/js-exercises/LogString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var myString="hello"+ " "+ "world";

@marcianoviereck marcianoviereck Nov 30, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's better to use var or let here?

Also, don't forget to add some spacing between your variable and the value. So like this:
var myString = "hello" + " " + "world";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, I have made some changes yesterday, but it is in commits section. whould you plz take a look?

console.log('greetings');
console.log(myString);

var myString="love you";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will give a already defined error, because you have already defined myString a couple lines above.
Could you look at this again?

console.log('love');
console.log(myString);
25 changes: 25 additions & 0 deletions Week1/homework/js-exercises/RoundNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
let z=7.25;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again, good that you use let! But don't forget to add some spacing :)

let z = 7.25;

console.log(z);

let a = (Math.round(z));
console.log(a);


let highestValue=(Math.max(a,z));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow very nice!

Do you think it's better to use let or const here?:)

console.log(highestValue);



// let a=7;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove these, right? Because it's commented out

// let z=7.25;
// console.log(a===z);



// let result = a>z;
// alert (result);


// // alert(a>z);
// // alert(a<z);
// // alert(a=z);
9 changes: 9 additions & 0 deletions Week1/homework/js-exercises/arrayOfAnimals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var animals=[];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use let here:)

console.log('names of animals');
console.log(animals);
var newLength = animals.push('wolf');//it does not work here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean with it does not work here ?

var myPets = ["cat", "horse", "sheep"];
console.log(myPets);
// var newLength = myPets.push('wolf');//it works here.
console.log(myPets);

17 changes: 17 additions & 0 deletions Week1/homework/js-exercises/compareArray.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var names=['Nur','gul','tur','yuri'];
var numbers=[1,2,3,4,5,6,7];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's better to use let or var here?


console.log('The length of the array is ' + names.length);
// console.log(names.length);
console.log('The length of the array is ' + numbers.length);
// console.log(numbers.length);

let compare = 'names.length === numbers.length';
compare=false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you made a mistake here, can you take a look at this and see if you can fix it.



if (compare) {
console.log('They are the same!');
} else {
console.log('Two different sizes');
}
22 changes: 22 additions & 0 deletions Week1/homework/js-exercises/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>js-exersize</title>
</head>
<body>
<h1>salam</h1>





</body>




<script src="compareArray.js"></script>
</html>
8 changes: 8 additions & 0 deletions Week1/homework/js-exercises/lengthString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict'
var mySentence ="Programming is so interesting!";
var length=mySentence.length;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, is it better to use var or let?

console.log(length);

// console.log(mySentence.length);

// document.write(mySentence.length);
26 changes: 26 additions & 0 deletions Week1/homework/js-exercises/logHello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'
var a = 'Hello'+ " " +'world!';//english

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the var a here and just directly log the value. Like this:

console.log('Hello'+ " " +'world!');

And also for all the others:)

console.log(a);
var a = 'Selam ' + " " +'Dünya';//turkish
console.log(a);
var a = 'salve ' + " " +'mundi!';//
console.log(a);
var a = 'こんにちは' + " " +'世界!';//japanese
console.log(a);
var a = '안녕 ' + " " +'세상!';//korean
console.log(a);
var a = 'Hallo'+ " " +'wereld!';//dutch
console.log(a);
var a = 'مرحبا'+ " " +'عالم!';//arabic
console.log(a);
var a = 'سلام' + " " +'دنیا!';//iran
console.log(a);
var a = 'سالام'+ " " +'دۇنيا!';//uyghur
console.log(a);
var a = 'ciao'+ " " +'mondo!';
console.log(a);





9 changes: 9 additions & 0 deletions Week1/homework/js-exercises/lognumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';
let numberX;
console.log('number');
console.log(12);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the value here 12? Are you sure:)?


//
var numberX = 12;
console.log('month');
console.log(12);
20 changes: 20 additions & 0 deletions Week1/homework/js-exercises/remainder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'
let x = 7;
x = x % 3;
x %= 3;// 7-3-3=1
console.log(x);


let y=21;
y=y%4;
y %= 4;// 21-4-4-4-4-4=1;
console.log(y);


let z=13;
z=z%2;
z %= 2;// 13-2-2-2-2-2-2=1
console.log(z);



5 changes: 5 additions & 0 deletions Week1/homework/js-exercises/typeChecker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

var fruit='apple';
var fruit='pear';
var car = { type: "Fiat", model: "500", color: "white" };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you didn't finish this assignment, can you take a look at it again?