From 6cda8f0602f6d9218afd84e66271703a7438e4f8 Mon Sep 17 00:00:00 2001 From: Olesya Date: Mon, 12 Nov 2018 17:45:36 +0300 Subject: [PATCH 1/6] Update tringleinaloap set new count iterations --- JS/tringleinaloap.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JS/tringleinaloap.html b/JS/tringleinaloap.html index f5a8eaf..b68f20f 100644 --- a/JS/tringleinaloap.html +++ b/JS/tringleinaloap.html @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/JS/countBeans.html b/JS/countBeans.html new file mode 100644 index 0000000..b90cd43 --- /dev/null +++ b/JS/countBeans.html @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/JS/sumRange.html b/JS/sumRange.html new file mode 100644 index 0000000..81458c0 --- /dev/null +++ b/JS/sumRange.html @@ -0,0 +1,38 @@ + \ No newline at end of file From bb92d4e9e58d90ad64fe43d38e90185887762e42 Mon Sep 17 00:00:00 2001 From: Olesya Date: Fri, 16 Nov 2018 01:44:35 +0300 Subject: [PATCH 4/6] Changing -Change .js -Change with ?:: -Change "function(){" -FizzBazz delete a; -Change Document.write to console.log --- JS/ChessBoard.js | 15 +++++++++++++++ JS/FizzBuzz.js | 7 +++++++ JS/Recursion.js | 8 ++++++++ JS/countBeans.js | 23 +++++++++++++++++++++++ JS/min.js | 7 +++++++ JS/sumRange.js | 30 ++++++++++++++++++++++++++++++ JS/tringleinaloap.js | 7 +++++++ 7 files changed, 97 insertions(+) create mode 100644 JS/ChessBoard.js create mode 100644 JS/FizzBuzz.js create mode 100644 JS/Recursion.js create mode 100644 JS/countBeans.js create mode 100644 JS/min.js create mode 100644 JS/sumRange.js create mode 100644 JS/tringleinaloap.js diff --git a/JS/ChessBoard.js b/JS/ChessBoard.js new file mode 100644 index 0000000..6d67e1a --- /dev/null +++ b/JS/ChessBoard.js @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/JS/FizzBuzz.js b/JS/FizzBuzz.js new file mode 100644 index 0000000..e78d7ea --- /dev/null +++ b/JS/FizzBuzz.js @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/JS/Recursion.js b/JS/Recursion.js new file mode 100644 index 0000000..173dba1 --- /dev/null +++ b/JS/Recursion.js @@ -0,0 +1,8 @@ +var N = prompt("Write N = ",''); +var k = Math.abs(N); +function Recursia(k) +{ + return(k == 0)?0:1; + if((k!=0)&&(k!=1)) return Recursia(k-2); +} +console.log(Recursia(k)); \ No newline at end of file diff --git a/JS/countBeans.js b/JS/countBeans.js new file mode 100644 index 0000000..a27dfdb --- /dev/null +++ b/JS/countBeans.js @@ -0,0 +1,23 @@ +/*Первая часть задания*/ +var str = prompt("Write some word =",''); +var l=str.length; +function countsBs(str){ + for(var i=0;i +alert("Write two numbers a and b for comparison"); +var a = prompt("Write a = ",''); +var b = prompt("Write b = ",''); +function min(a,b){ return (a>b)? b:a;} +document.write(min(a,b)); + \ No newline at end of file diff --git a/JS/sumRange.js b/JS/sumRange.js new file mode 100644 index 0000000..1c9aa8e --- /dev/null +++ b/JS/sumRange.js @@ -0,0 +1,30 @@ +var start = prompt("Start with =",''); +var finish = prompt("Finish on =",''); +var mass=[]; +function range(b,e){ + for(var i=1;i<=e;i++){ + mass.push(i); + } +return mass; +} +console.log(range(start,finish)); +//Дополненная range из третьей части задания +/*var l=prompt("Write step = ",''); +var step = Math.abs(l); +function range(b,e,s){ + for(var i=1;i<=e;i++){ + mass.push(i); + i+=(s-1); + } +return mass; +} +console.log(range(start,finish,step)); +*/ +var elem=0; +function sum(mass){ + for(var i=0;i +var a="#"; +for(var i=0;i<=6;i++){ +console.log(a); +a+="#"; +} + From 50d2824623068f782ee1ef581bf0ce579de34f61 Mon Sep 17 00:00:00 2001 From: Olesya Date: Fri, 16 Nov 2018 01:48:29 +0300 Subject: [PATCH 5/6] +Chanching --- JS/ChessBoard.js | 4 +--- JS/FizzBuzz.js | 4 +--- JS/min.js | 4 +--- JS/tringleinaloap.js | 3 +-- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/JS/ChessBoard.js b/JS/ChessBoard.js index 6d67e1a..89a60d7 100644 --- a/JS/ChessBoard.js +++ b/JS/ChessBoard.js @@ -1,4 +1,3 @@ - \ No newline at end of file +} \ No newline at end of file diff --git a/JS/FizzBuzz.js b/JS/FizzBuzz.js index e78d7ea..84bb73c 100644 --- a/JS/FizzBuzz.js +++ b/JS/FizzBuzz.js @@ -1,7 +1,5 @@ - \ No newline at end of file +} \ No newline at end of file diff --git a/JS/min.js b/JS/min.js index 25e70e5..085c4b0 100644 --- a/JS/min.js +++ b/JS/min.js @@ -1,7 +1,5 @@ - \ No newline at end of file +document.write(min(a,b)); \ No newline at end of file diff --git a/JS/tringleinaloap.js b/JS/tringleinaloap.js index a8969fc..cd50d17 100644 --- a/JS/tringleinaloap.js +++ b/JS/tringleinaloap.js @@ -1,7 +1,6 @@ - + From ed8f183f1ad1924db9e34ba5ce590502ffed8a5b Mon Sep 17 00:00:00 2001 From: Olesya Date: Thu, 22 Nov 2018 01:50:20 +0300 Subject: [PATCH 6/6] +NewFilesInMenu Add to: -menu with file.js; -new sumRange,Reverse,List,Comparison; -somthing programs with 'if'; -arrow-function; --- JS/Comparison.js | 18 ++++++++++++++++++ JS/List.js | 43 ++++++++++++++++++++++++++++++++++++++++++ JS/Reverse.js | 27 ++++++++++++++++++++++++++ JS/countBeans.js | 11 +++++------ JS/menu.html | 19 +++++++++++++++++++ JS/min.js | 5 +++-- JS/sumRange.js | 1 + JS/tringleinaloap.html | 9 --------- JS/tringleinaloap.js | 1 + 9 files changed, 117 insertions(+), 17 deletions(-) create mode 100644 JS/Comparison.js create mode 100644 JS/List.js create mode 100644 JS/Reverse.js create mode 100644 JS/menu.html delete mode 100644 JS/tringleinaloap.html diff --git a/JS/Comparison.js b/JS/Comparison.js new file mode 100644 index 0000000..06f122b --- /dev/null +++ b/JS/Comparison.js @@ -0,0 +1,18 @@ +var obj={here:{is:"an"},object:2}; +var deepEqual=(a,b)=>{ +if((a&&b)!=null){ + if (((typeof a)&&(typeof b))=="object") { + for (var part in a) { + if (b.hasOwnProperty(part)) + return deepEqual(a[part], b[part]); + } + } + else{ + if(a===b) {return true;} + else {return false;} +} +}else {return true;} +} +console.log(deepEqual(obj,obj)); +console.log(deepEqual(obj,{here:1,object:2})); +console.log(deepEqual(obj,{here:{is:"an"},object:2})); \ No newline at end of file diff --git a/JS/List.js b/JS/List.js new file mode 100644 index 0000000..5aa3f63 --- /dev/null +++ b/JS/List.js @@ -0,0 +1,43 @@ +var arrayToList=(arr)=>{ +var list = {value: arr[0] }; +var list2 = list; +for(var i=1;i{ +var arr=[]; +var i=0; +while(list!=null){ +arr[i]=list.value; +i++; +list = list.next; +} +return arr; +} +console.log(ListToarray(arrayToList([10,20,30]))); + +var prepend=(a,list)=>{ +var list1; +list1={value:a}; +list1.next = list; +return list1; +} +console.log(prepend(20,null)); +console.log(prepend(10,prepend(20,null))); + +var number; +var nth=(list,b)=>{ +var count=0; +number=list.value; +if (count!=b){ + list1=list.next; + nth(list1,(b-1)); + } +return number; +} +console.log(nth(arrayToList([10,20,30]),1)); \ No newline at end of file diff --git a/JS/Reverse.js b/JS/Reverse.js new file mode 100644 index 0000000..28c00e4 --- /dev/null +++ b/JS/Reverse.js @@ -0,0 +1,27 @@ +function reverseArray(mass){ +var mass1 = []; +for(var i=mass.length-1;i>=0;i--){ +mass1[mass.length-i-1]=mass[i];} +return mass1; +} +console.log(reverseArray(["A","B","C"])); + +var arr=[1,2,3,4,5] +function reverseArrayInPlace(arr){ +var mass2 = []; +for(var i=arr.length-1;i>=0;i--){ +mass2[arr.length-i-1]=arr[i];} +return mass2; +} +console.log(reverseArrayInPlace(arr)); + +/*более эффективный +var arr=[1,2,3,4,5] +arr.reverseArrayInPlace=function(){ +var mass2 = []; +for(var i=this.length-1;i>=0;i--){ +mass2[this.length-i-1]=this[i];} +return mass2; +} +console.log(arr.reverseArrayInPlace()); +*/ diff --git a/JS/countBeans.js b/JS/countBeans.js index a27dfdb..117d2b6 100644 --- a/JS/countBeans.js +++ b/JS/countBeans.js @@ -1,7 +1,7 @@ /*Первая часть задания*/ var str = prompt("Write some word =",''); var l=str.length; -function countsBs(str){ +var countsBs=(str)=>{ for(var i=0;i + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JS/min.js b/JS/min.js index 085c4b0..5821fbf 100644 --- a/JS/min.js +++ b/JS/min.js @@ -1,5 +1,6 @@ +console.log("Глава: Функции"); alert("Write two numbers a and b for comparison"); var a = prompt("Write a = ",''); var b = prompt("Write b = ",''); -function min(a,b){ return (a>b)? b:a;} -document.write(min(a,b)); \ No newline at end of file +var min=(a,b)=>{ return (a>b)? b:a;} +console.log(min(a,b)); \ No newline at end of file diff --git a/JS/sumRange.js b/JS/sumRange.js index 1c9aa8e..2626275 100644 --- a/JS/sumRange.js +++ b/JS/sumRange.js @@ -1,3 +1,4 @@ +console.log("Глава: Структуры данных. Объекты и массивы"); var start = prompt("Start with =",''); var finish = prompt("Finish on =",''); var mass=[]; diff --git a/JS/tringleinaloap.html b/JS/tringleinaloap.html deleted file mode 100644 index f5a8eaf..0000000 --- a/JS/tringleinaloap.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/JS/tringleinaloap.js b/JS/tringleinaloap.js index cd50d17..539f75a 100644 --- a/JS/tringleinaloap.js +++ b/JS/tringleinaloap.js @@ -1,3 +1,4 @@ +console.log("Глава: Структура программ"); var a="#"; for(var i=0;i<=6;i++){ console.log(a);