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
Prev Previous commit
Next Next commit
add changes, till step 8
  • Loading branch information
EnwerMemet committed Nov 30, 2019
commit c8392a00ebac1d3daed902e754e1c5ed982953b2
6 changes: 3 additions & 3 deletions Week1/homework/js-exercises/LogString.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var myString="hello"+ " "+ "world";
console.log('greetings');
let myString="Enwer Memet";
console.log(`my fullname`);
console.log(myString);

var myString="love you";
myString="love you";
console.log('love');
console.log(myString);
8 changes: 5 additions & 3 deletions Week1/homework/js-exercises/arrayOfAnimals.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
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(`an empty array`);
console.log(animals);
var newLength = animals.push('wolf');//it does not work here.

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


myPets.push('Piglet');
console.log(myPets);

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

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;
let compare = names.length === numbers.length;
console.log(compare);


if (compare) {
if (names.length === numbers.length) {
console.log('They are the same!');
} else {
console.log('Two different sizes');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
console.log("I'm awesome");

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

console.log('I\'m awesome');
console.log(`I'm awesome`);
2 changes: 1 addition & 1 deletion Week1/homework/js-exercises/lengthString.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ 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);

// or
// console.log(mySentence.length);

// document.write(mySentence.length);
40 changes: 20 additions & 20 deletions Week1/homework/js-exercises/logHello.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
'use strict'
var a = 'Hello'+ " " +'world!';//english
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);
let a = 'Hello'+ " " +'world!';//english
console.log(a);
let b = 'Selam ' + " " +'Dünya';//turkish
console.log(b);
let c = 'salve ' + " " +'mundi!';//
console.log(c);
let a = 'こんにちは' + " " +'世界!';//japanese
console.log(a);
let d = '안녕 ' + " " +'세상!';//korean
console.log(d);
let e = 'Hallo'+ " " +'wereld!';//dutch
console.log(e);
let f = 'مرحبا'+ " " +'عالم!';//arabic
console.log(f);
let g = 'سلام' + " " +'دنیا!';//iran
console.log(g);
let h = 'سالام'+ " " +'دۇنيا!';//uyghur
console.log(h);
let i = 'ciao'+ " " +'mondo!';
console.log(i);



Expand Down
12 changes: 6 additions & 6 deletions Week1/homework/js-exercises/lognumber.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
let numberX;
console.log('number');
console.log(12);
let x;
console.log('I think the value of x is undifined ');
console.log(x);

//
var numberX = 12;
console.log('month');
console.log(12);
x = 12;
console.log(`i think it's an integer, its value is 12`);
console.log(x);
53 changes: 50 additions & 3 deletions Week1/homework/js-exercises/typeChecker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
'use strict'
let fruit='apple';
let user='enwer';
const car = { type: "Fiat", model: "500", color: "white" };
const team = { type: "lakers", model: "1990", color: "yellow" };

var fruit='apple';
var fruit='pear';
var car = { type: "Fiat", model: "500", color: "white" };
if (typeof fruit === typeof user) {
console.log('fruit and user : SAME TYPE')
}
else {
console.log('fruit and user: Not the same...')
}


if (typeof fruit === typeof car) {
console.log('fruit and car : SAME TYPE')
}
else {
console.log('fruit and car: Not the same...')
}


if (typeof fruit === typeof team) {
console.log('fruit and team : SAME TYPE')
}
else {
console.log('fruit and team: Not the same...')
}


if (typeof fruit === typeof user) {
console.log('fruit and user : SAME TYPE')
}
else {
console.log('fruit and user: Not the same...')
}


if (typeof team === typeof user) {
console.log('team and user : SAME TYPE')
}
else {
console.log('team and user: Not the same...')
}


if (typeof car === typeof team) {
console.log('car and team : SAME TYPE')
}
else {
console.log('car and team: Not the same...')
}