From 72c85b43dc31487be83a9f14bdf3cedb2564292e Mon Sep 17 00:00:00 2001 From: KTsarenko Date: Wed, 7 Nov 2018 23:57:13 +0200 Subject: [PATCH 01/11] hw_2-1 done --- .../homework_2/hw2-1_js.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js new file mode 100644 index 000000000..ae0bc4180 --- /dev/null +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js @@ -0,0 +1,32 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +rl.question('Ведите высоту пирамиды: ', (answer) => { + let intRegex = /^[0-9]+$/; + if (intRegex.test(answer)) { + let height = parseInt(answer); + let space = " "; + let symbol = "#"; + let i = 2; + let repeatStr = height += i; + + for (i; i < repeatStr; i++) { + let spaceRep = space.repeat(height - i); + let symbolRep = symbol.repeat(i); + let strResult = spaceRep + symbolRep + symbolRep + spaceRep; + console.log(strResult); + } + rl.close(); + } else { + console.log('Ошибка ввода.'); + rl.close(); + } + +}); + + + From 8d92970cd83b0744d6afa69635b5cd09854e5037 Mon Sep 17 00:00:00 2001 From: KTsarenko Date: Sat, 10 Nov 2018 18:45:41 +0200 Subject: [PATCH 02/11] hw_2-1 done --- .../konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js | 4 +--- .../konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js | 0 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js index ae0bc4180..8baac1cd3 100644 --- a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js @@ -6,8 +6,7 @@ const rl = readline.createInterface({ }); rl.question('Ведите высоту пирамиды: ', (answer) => { - let intRegex = /^[0-9]+$/; - if (intRegex.test(answer)) { + if (!isNaN(Math.round(answer))) { let height = parseInt(answer); let space = " "; let symbol = "#"; @@ -25,7 +24,6 @@ rl.question('Ведите высоту пирамиды: ', (answer) => { console.log('Ошибка ввода.'); rl.close(); } - }); diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js new file mode 100644 index 000000000..e69de29bb From 078e2a876536be233e405ffe37e677770331ca9d Mon Sep 17 00:00:00 2001 From: Darknel Date: Sat, 10 Nov 2018 18:58:38 +0200 Subject: [PATCH 03/11] homework_2_evgen_kushnir --- .../homework_2/.eslintrc.js | 266 ++++++++++++++++++ .../homework_2/numbers.js | 7 + .../homework_2/piramid.js | 10 + 3 files changed, 283 insertions(+) create mode 100644 homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js create mode 100644 homeworks/evgen.kushnir_darknel/homework_2/numbers.js create mode 100644 homeworks/evgen.kushnir_darknel/homework_2/piramid.js diff --git a/homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js b/homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js new file mode 100644 index 000000000..36b9d9621 --- /dev/null +++ b/homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js @@ -0,0 +1,266 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "rules": { + "accessor-pairs": "error", + "array-bracket-newline": "error", + "array-bracket-spacing": "error", + "array-callback-return": "error", + "array-element-newline": "error", + "arrow-body-style": "error", + "arrow-parens": "error", + "arrow-spacing": "error", + "block-scoped-var": "error", + "block-spacing": "error", + "brace-style": "error", + "callback-return": "error", + "camelcase": "error", + "capitalized-comments": "error", + "class-methods-use-this": "error", + "comma-dangle": "error", + "comma-spacing": "error", + "comma-style": "error", + "complexity": "error", + "computed-property-spacing": "error", + "consistent-return": "error", + "consistent-this": "error", + "curly": "error", + "default-case": "error", + "dot-location": "error", + "dot-notation": "error", + "eol-last": [ + "error", + "never" + ], + "eqeqeq": "error", + "func-call-spacing": "error", + "func-name-matching": "error", + "func-names": "error", + "func-style": "error", + "function-paren-newline": "error", + "generator-star-spacing": "error", + "global-require": "error", + "guard-for-in": "error", + "handle-callback-err": "error", + "id-blacklist": "error", + "id-length": "off", + "id-match": "error", + "implicit-arrow-linebreak": "error", + "indent": "error", + "indent-legacy": "error", + "init-declarations": "error", + "jsx-quotes": "error", + "key-spacing": "error", + "keyword-spacing": "error", + "line-comment-position": "error", + "linebreak-style": [ + "error", + "unix" + ], + "lines-around-comment": "error", + "lines-around-directive": "error", + "lines-between-class-members": "error", + "max-classes-per-file": "error", + "max-depth": "error", + "max-len": "off", + "max-lines": "error", + "max-lines-per-function": "error", + "max-nested-callbacks": "error", + "max-params": "error", + "max-statements": "error", + "max-statements-per-line": "error", + "multiline-comment-style": "error", + "multiline-ternary": "error", + "new-cap": "error", + "new-parens": "error", + "newline-after-var": [ + "error", + "always" + ], + "newline-before-return": "error", + "newline-per-chained-call": "error", + "no-alert": "error", + "no-array-constructor": "error", + "no-async-promise-executor": "error", + "no-await-in-loop": "error", + "no-bitwise": "error", + "no-buffer-constructor": "error", + "no-caller": "error", + "no-catch-shadow": "error", + "no-confusing-arrow": "error", + "no-continue": "error", + "no-div-regex": "error", + "no-duplicate-imports": "error", + "no-else-return": "error", + "no-empty-function": "error", + "no-eq-null": "error", + "no-eval": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-label": "error", + "no-extra-parens": "error", + "no-floating-decimal": "error", + "no-implicit-coercion": "error", + "no-implicit-globals": "error", + "no-implied-eval": "error", + "no-inline-comments": "error", + "no-invalid-this": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "error", + "no-magic-numbers": "off", + "no-misleading-character-class": "error", + "no-mixed-operators": "error", + "no-mixed-requires": "error", + "no-multi-assign": "error", + "no-multi-spaces": "error", + "no-multi-str": "error", + "no-multiple-empty-lines": "error", + "no-native-reassign": "error", + "no-negated-condition": "error", + "no-negated-in-lhs": "error", + "no-nested-ternary": "error", + "no-new": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-require": "error", + "no-new-wrappers": "error", + "no-octal-escape": "error", + "no-param-reassign": "error", + "no-path-concat": "error", + "no-plusplus": [ + "error", + { + "allowForLoopAfterthoughts": true + } + ], + "no-process-env": "error", + "no-process-exit": "error", + "no-proto": "error", + "no-prototype-builtins": "error", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-modules": "error", + "no-restricted-properties": "error", + "no-restricted-syntax": "error", + "no-return-assign": "error", + "no-return-await": "error", + "no-script-url": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-shadow": "error", + "no-shadow-restricted-names": "error", + "no-spaced-func": "error", + "no-sync": "error", + "no-tabs": "error", + "no-template-curly-in-string": "error", + "no-ternary": "error", + "no-throw-literal": "error", + "no-trailing-spaces": "error", + "no-undef-init": "error", + "no-undefined": "error", + "no-underscore-dangle": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unused-expressions": "error", + "no-use-before-define": "error", + "no-useless-call": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-rename": "error", + "no-useless-return": "error", + "no-var": "error", + "no-void": "error", + "no-warning-comments": "error", + "no-whitespace-before-property": "error", + "no-with": "error", + "nonblock-statement-body-position": "error", + "object-curly-newline": "error", + "object-curly-spacing": "error", + "object-property-newline": "error", + "object-shorthand": "error", + "one-var": "off", + "one-var-declaration-per-line": "error", + "operator-assignment": [ + "error", + "never" + ], + "operator-linebreak": "error", + "padded-blocks": "off", + "padding-line-between-statements": "error", + "prefer-arrow-callback": "error", + "prefer-const": "error", + "prefer-destructuring": "error", + "prefer-numeric-literals": "error", + "prefer-object-spread": "error", + "prefer-promise-reject-errors": "error", + "prefer-reflect": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "prefer-template": "error", + "quote-props": "error", + "quotes": [ + "error", + "double" + ], + "radix": "error", + "require-atomic-updates": "error", + "require-await": "error", + "require-jsdoc": "error", + "require-unicode-regexp": "error", + "rest-spread-spacing": "error", + "semi": "error", + "semi-spacing": [ + "error", + { + "after": true, + "before": false + } + ], + "semi-style": [ + "error", + "last" + ], + "sort-imports": "error", + "sort-keys": "error", + "sort-vars": "error", + "space-before-blocks": "error", + "space-before-function-paren": "error", + "space-in-parens": [ + "error", + "never" + ], + "space-infix-ops": "error", + "space-unary-ops": "error", + "spaced-comment": "error", + "strict": "error", + "switch-colon-spacing": "error", + "symbol-description": "error", + "template-curly-spacing": "error", + "template-tag-spacing": "error", + "unicode-bom": [ + "error", + "never" + ], + "valid-jsdoc": "error", + "vars-on-top": "error", + "wrap-iife": "error", + "wrap-regex": "error", + "yield-star-spacing": "error", + "yoda": [ + "error", + "never" + ] + } +}; \ No newline at end of file diff --git a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js new file mode 100644 index 000000000..c03c29c96 --- /dev/null +++ b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js @@ -0,0 +1,7 @@ +for (let test = 500; test < 1000; test++) { + const numberTest = test.toString().split("").reverse().join(""); + const numberTestCheck = test.toString(); + if (numberTest === numberTestCheck) { + console.log(test + " " + typeof test); + } +} \ No newline at end of file diff --git a/homeworks/evgen.kushnir_darknel/homework_2/piramid.js b/homeworks/evgen.kushnir_darknel/homework_2/piramid.js new file mode 100644 index 000000000..f9686d983 --- /dev/null +++ b/homeworks/evgen.kushnir_darknel/homework_2/piramid.js @@ -0,0 +1,10 @@ +const symbol = '#'; +let startNumber = 4; +const emptySpace = ' '; +let emptySpaceNumber = 14; + +for (let i = 0; i < 15; i++) { + console.log(emptySpace.repeat(emptySpaceNumber) + symbol.repeat(startNumber)); + startNumber = startNumber + 2; + emptySpaceNumber = emptySpaceNumber - 1; +} \ No newline at end of file From e160ecba345ddb6b6c8a3037a0812db30ccc0388 Mon Sep 17 00:00:00 2001 From: Evgen Kushnir Date: Sat, 10 Nov 2018 21:36:34 +0200 Subject: [PATCH 04/11] Delete .eslintrc.js --- .../homework_2/.eslintrc.js | 266 ------------------ 1 file changed, 266 deletions(-) delete mode 100644 homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js diff --git a/homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js b/homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js deleted file mode 100644 index 36b9d9621..000000000 --- a/homeworks/evgen.kushnir_darknel/homework_2/.eslintrc.js +++ /dev/null @@ -1,266 +0,0 @@ -module.exports = { - "env": { - "browser": true, - "es6": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "rules": { - "accessor-pairs": "error", - "array-bracket-newline": "error", - "array-bracket-spacing": "error", - "array-callback-return": "error", - "array-element-newline": "error", - "arrow-body-style": "error", - "arrow-parens": "error", - "arrow-spacing": "error", - "block-scoped-var": "error", - "block-spacing": "error", - "brace-style": "error", - "callback-return": "error", - "camelcase": "error", - "capitalized-comments": "error", - "class-methods-use-this": "error", - "comma-dangle": "error", - "comma-spacing": "error", - "comma-style": "error", - "complexity": "error", - "computed-property-spacing": "error", - "consistent-return": "error", - "consistent-this": "error", - "curly": "error", - "default-case": "error", - "dot-location": "error", - "dot-notation": "error", - "eol-last": [ - "error", - "never" - ], - "eqeqeq": "error", - "func-call-spacing": "error", - "func-name-matching": "error", - "func-names": "error", - "func-style": "error", - "function-paren-newline": "error", - "generator-star-spacing": "error", - "global-require": "error", - "guard-for-in": "error", - "handle-callback-err": "error", - "id-blacklist": "error", - "id-length": "off", - "id-match": "error", - "implicit-arrow-linebreak": "error", - "indent": "error", - "indent-legacy": "error", - "init-declarations": "error", - "jsx-quotes": "error", - "key-spacing": "error", - "keyword-spacing": "error", - "line-comment-position": "error", - "linebreak-style": [ - "error", - "unix" - ], - "lines-around-comment": "error", - "lines-around-directive": "error", - "lines-between-class-members": "error", - "max-classes-per-file": "error", - "max-depth": "error", - "max-len": "off", - "max-lines": "error", - "max-lines-per-function": "error", - "max-nested-callbacks": "error", - "max-params": "error", - "max-statements": "error", - "max-statements-per-line": "error", - "multiline-comment-style": "error", - "multiline-ternary": "error", - "new-cap": "error", - "new-parens": "error", - "newline-after-var": [ - "error", - "always" - ], - "newline-before-return": "error", - "newline-per-chained-call": "error", - "no-alert": "error", - "no-array-constructor": "error", - "no-async-promise-executor": "error", - "no-await-in-loop": "error", - "no-bitwise": "error", - "no-buffer-constructor": "error", - "no-caller": "error", - "no-catch-shadow": "error", - "no-confusing-arrow": "error", - "no-continue": "error", - "no-div-regex": "error", - "no-duplicate-imports": "error", - "no-else-return": "error", - "no-empty-function": "error", - "no-eq-null": "error", - "no-eval": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-label": "error", - "no-extra-parens": "error", - "no-floating-decimal": "error", - "no-implicit-coercion": "error", - "no-implicit-globals": "error", - "no-implied-eval": "error", - "no-inline-comments": "error", - "no-invalid-this": "error", - "no-iterator": "error", - "no-label-var": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-lonely-if": "error", - "no-loop-func": "error", - "no-magic-numbers": "off", - "no-misleading-character-class": "error", - "no-mixed-operators": "error", - "no-mixed-requires": "error", - "no-multi-assign": "error", - "no-multi-spaces": "error", - "no-multi-str": "error", - "no-multiple-empty-lines": "error", - "no-native-reassign": "error", - "no-negated-condition": "error", - "no-negated-in-lhs": "error", - "no-nested-ternary": "error", - "no-new": "error", - "no-new-func": "error", - "no-new-object": "error", - "no-new-require": "error", - "no-new-wrappers": "error", - "no-octal-escape": "error", - "no-param-reassign": "error", - "no-path-concat": "error", - "no-plusplus": [ - "error", - { - "allowForLoopAfterthoughts": true - } - ], - "no-process-env": "error", - "no-process-exit": "error", - "no-proto": "error", - "no-prototype-builtins": "error", - "no-restricted-globals": "error", - "no-restricted-imports": "error", - "no-restricted-modules": "error", - "no-restricted-properties": "error", - "no-restricted-syntax": "error", - "no-return-assign": "error", - "no-return-await": "error", - "no-script-url": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-shadow": "error", - "no-shadow-restricted-names": "error", - "no-spaced-func": "error", - "no-sync": "error", - "no-tabs": "error", - "no-template-curly-in-string": "error", - "no-ternary": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-undefined": "error", - "no-underscore-dangle": "error", - "no-unmodified-loop-condition": "error", - "no-unneeded-ternary": "error", - "no-unused-expressions": "error", - "no-use-before-define": "error", - "no-useless-call": "error", - "no-useless-computed-key": "error", - "no-useless-concat": "error", - "no-useless-constructor": "error", - "no-useless-rename": "error", - "no-useless-return": "error", - "no-var": "error", - "no-void": "error", - "no-warning-comments": "error", - "no-whitespace-before-property": "error", - "no-with": "error", - "nonblock-statement-body-position": "error", - "object-curly-newline": "error", - "object-curly-spacing": "error", - "object-property-newline": "error", - "object-shorthand": "error", - "one-var": "off", - "one-var-declaration-per-line": "error", - "operator-assignment": [ - "error", - "never" - ], - "operator-linebreak": "error", - "padded-blocks": "off", - "padding-line-between-statements": "error", - "prefer-arrow-callback": "error", - "prefer-const": "error", - "prefer-destructuring": "error", - "prefer-numeric-literals": "error", - "prefer-object-spread": "error", - "prefer-promise-reject-errors": "error", - "prefer-reflect": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", - "prefer-template": "error", - "quote-props": "error", - "quotes": [ - "error", - "double" - ], - "radix": "error", - "require-atomic-updates": "error", - "require-await": "error", - "require-jsdoc": "error", - "require-unicode-regexp": "error", - "rest-spread-spacing": "error", - "semi": "error", - "semi-spacing": [ - "error", - { - "after": true, - "before": false - } - ], - "semi-style": [ - "error", - "last" - ], - "sort-imports": "error", - "sort-keys": "error", - "sort-vars": "error", - "space-before-blocks": "error", - "space-before-function-paren": "error", - "space-in-parens": [ - "error", - "never" - ], - "space-infix-ops": "error", - "space-unary-ops": "error", - "spaced-comment": "error", - "strict": "error", - "switch-colon-spacing": "error", - "symbol-description": "error", - "template-curly-spacing": "error", - "template-tag-spacing": "error", - "unicode-bom": [ - "error", - "never" - ], - "valid-jsdoc": "error", - "vars-on-top": "error", - "wrap-iife": "error", - "wrap-regex": "error", - "yield-star-spacing": "error", - "yoda": [ - "error", - "never" - ] - } -}; \ No newline at end of file From e6b31ce532e3b55ad39d8ef1061d2e933e0a5f0a Mon Sep 17 00:00:00 2001 From: KTsarenko Date: Sat, 10 Nov 2018 22:58:42 +0200 Subject: [PATCH 05/11] hw_2-2 done --- .../homework_2/hw2-2_js.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js index e69de29bb..0607fdfae 100644 --- a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js @@ -0,0 +1,25 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +rl.question('Ведите минимальное значение: ', (answer) => { + let minNum = parseInt(answer); + rl.question('Ведите максимальное значение: ', (answer2) => { + if (!isNaN(Math.round(answer2)) && !isNaN(Math.round(answer))) { + let maxNum = parseInt(answer2); + for (i = minNum; i <= maxNum; i++) { + let num = i.toString(); + if (num === num.split('').reverse().join('')) { + console.log(num) + } + } + rl.close(); + } else { + console.log('Ошибка ввода.'); + rl.close(); + } + }); +}); From e39a402a3ab31f6f2abe55d65b141f63797a9275 Mon Sep 17 00:00:00 2001 From: KTsarenko Date: Sat, 10 Nov 2018 23:41:38 +0200 Subject: [PATCH 06/11] hw_2-2 done --- .../homework_2/hw2-1_js.js | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js index 8baac1cd3..2b4d77358 100644 --- a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js @@ -6,16 +6,14 @@ const rl = readline.createInterface({ }); rl.question('Ведите высоту пирамиды: ', (answer) => { - if (!isNaN(Math.round(answer))) { - let height = parseInt(answer); - let space = " "; - let symbol = "#"; + if (!Number.isNaN(Math.round(answer))) { + let height = parseInt(answer, 10) + 2; + const space = ' '; + const symbol = '#'; let i = 2; - let repeatStr = height += i; - - for (i; i < repeatStr; i++) { - let spaceRep = space.repeat(height - i); - let symbolRep = symbol.repeat(i); + for (i; i < height; i++) { + const spaceRep = space.repeat(height - i); + const symbolRep = symbol.repeat(i); let strResult = spaceRep + symbolRep + symbolRep + spaceRep; console.log(strResult); } @@ -24,7 +22,4 @@ rl.question('Ведите высоту пирамиды: ', (answer) => { console.log('Ошибка ввода.'); rl.close(); } -}); - - - +}); \ No newline at end of file From a2d772dbd1f1a10dec993a83e0b453c697b5ac91 Mon Sep 17 00:00:00 2001 From: KTsarenko Date: Sat, 10 Nov 2018 23:53:44 +0200 Subject: [PATCH 07/11] hw_2-2 fixed --- .../homework_2/hw2-1_js.js | 8 ++++---- .../homework_2/hw2-2_js.js | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js index 2b4d77358..faaa49407 100644 --- a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js @@ -2,19 +2,19 @@ const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, - output: process.stdout + output: process.stdout, }); rl.question('Ведите высоту пирамиды: ', (answer) => { if (!Number.isNaN(Math.round(answer))) { - let height = parseInt(answer, 10) + 2; + const height = parseInt(answer, 10) + 2; const space = ' '; const symbol = '#'; let i = 2; for (i; i < height; i++) { const spaceRep = space.repeat(height - i); const symbolRep = symbol.repeat(i); - let strResult = spaceRep + symbolRep + symbolRep + spaceRep; + const strResult = spaceRep + symbolRep + symbolRep + spaceRep; console.log(strResult); } rl.close(); @@ -22,4 +22,4 @@ rl.question('Ведите высоту пирамиды: ', (answer) => { console.log('Ошибка ввода.'); rl.close(); } -}); \ No newline at end of file +}); diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js index 0607fdfae..ec29d7ae9 100644 --- a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js @@ -2,18 +2,18 @@ const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, - output: process.stdout + output: process.stdout, }); rl.question('Ведите минимальное значение: ', (answer) => { - let minNum = parseInt(answer); + const minNum = parseInt(answer, 10); rl.question('Ведите максимальное значение: ', (answer2) => { - if (!isNaN(Math.round(answer2)) && !isNaN(Math.round(answer))) { - let maxNum = parseInt(answer2); - for (i = minNum; i <= maxNum; i++) { - let num = i.toString(); + if (!NumberisNaN(Math.round(answer2)) && !NumberisNaN(Math.round(answer))) { + const maxNum = parseInt(answer2, 10); + for (let i = minNum; i <= maxNum; i++) { + const num = i.toString(); if (num === num.split('').reverse().join('')) { - console.log(num) + console.log(num); } } rl.close(); From e955ce57857f3d1739dc9f5bb9a91bee72f911db Mon Sep 17 00:00:00 2001 From: KTsarenko Date: Sat, 10 Nov 2018 23:55:10 +0200 Subject: [PATCH 08/11] hw_2-2 fixed --- homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js index ec29d7ae9..a870ad2e9 100644 --- a/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js +++ b/homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js @@ -8,7 +8,7 @@ const rl = readline.createInterface({ rl.question('Ведите минимальное значение: ', (answer) => { const minNum = parseInt(answer, 10); rl.question('Ведите максимальное значение: ', (answer2) => { - if (!NumberisNaN(Math.round(answer2)) && !NumberisNaN(Math.round(answer))) { + if (!Number.isNaN(Math.round(answer2)) && !Number.isNaN(Math.round(answer))) { const maxNum = parseInt(answer2, 10); for (let i = minNum; i <= maxNum; i++) { const num = i.toString(); From ecb0a3316c8a8fffb37ae9c70c33248cccb1379c Mon Sep 17 00:00:00 2001 From: Darknel Date: Sun, 11 Nov 2018 00:32:12 +0200 Subject: [PATCH 09/11] Last update for homework_2 --- homeworks/evgen.kushnir_darknel/homework_2/numbers.js | 5 +++-- homeworks/evgen.kushnir_darknel/homework_2/piramid.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js index c03c29c96..0d255a3e9 100644 --- a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js +++ b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js @@ -1,7 +1,8 @@ for (let test = 500; test < 1000; test++) { - const numberTest = test.toString().split("").reverse().join(""); + const numberTest = test.toString().split('').reverse().join(''); const numberTestCheck = test.toString(); if (numberTest === numberTestCheck) { - console.log(test + " " + typeof test); + console.log(`${test} ${typeof test}`); } + // eslint-disable-next-line eol-last } \ No newline at end of file diff --git a/homeworks/evgen.kushnir_darknel/homework_2/piramid.js b/homeworks/evgen.kushnir_darknel/homework_2/piramid.js index f9686d983..c26b3729d 100644 --- a/homeworks/evgen.kushnir_darknel/homework_2/piramid.js +++ b/homeworks/evgen.kushnir_darknel/homework_2/piramid.js @@ -5,6 +5,7 @@ let emptySpaceNumber = 14; for (let i = 0; i < 15; i++) { console.log(emptySpace.repeat(emptySpaceNumber) + symbol.repeat(startNumber)); - startNumber = startNumber + 2; - emptySpaceNumber = emptySpaceNumber - 1; + startNumber += 2; + emptySpaceNumber -= 1; + // eslint-disable-next-line eol-last } \ No newline at end of file From 57ed85e5896222f548a32c930ff4849ae42cfce3 Mon Sep 17 00:00:00 2001 From: Darknel Date: Sun, 11 Nov 2018 01:11:23 +0200 Subject: [PATCH 10/11] Last update --- homeworks/evgen.kushnir_darknel/homework_2/numbers.js | 3 +-- homeworks/evgen.kushnir_darknel/homework_2/piramid.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js index 0d255a3e9..d77a92a5b 100644 --- a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js +++ b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js @@ -4,5 +4,4 @@ for (let test = 500; test < 1000; test++) { if (numberTest === numberTestCheck) { console.log(`${test} ${typeof test}`); } - // eslint-disable-next-line eol-last -} \ No newline at end of file +} diff --git a/homeworks/evgen.kushnir_darknel/homework_2/piramid.js b/homeworks/evgen.kushnir_darknel/homework_2/piramid.js index c26b3729d..615c853a8 100644 --- a/homeworks/evgen.kushnir_darknel/homework_2/piramid.js +++ b/homeworks/evgen.kushnir_darknel/homework_2/piramid.js @@ -7,5 +7,4 @@ for (let i = 0; i < 15; i++) { console.log(emptySpace.repeat(emptySpaceNumber) + symbol.repeat(startNumber)); startNumber += 2; emptySpaceNumber -= 1; - // eslint-disable-next-line eol-last -} \ No newline at end of file +} From 434f15fd15c78f713b3ac6cc40ee399a3e3466d6 Mon Sep 17 00:00:00 2001 From: Darknel Date: Sun, 11 Nov 2018 01:25:13 +0200 Subject: [PATCH 11/11] Last update v2.0 --- homeworks/evgen.kushnir_darknel/homework_2/numbers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js index d77a92a5b..2d86bd19e 100644 --- a/homeworks/evgen.kushnir_darknel/homework_2/numbers.js +++ b/homeworks/evgen.kushnir_darknel/homework_2/numbers.js @@ -2,6 +2,6 @@ for (let test = 500; test < 1000; test++) { const numberTest = test.toString().split('').reverse().join(''); const numberTestCheck = test.toString(); if (numberTest === numberTestCheck) { - console.log(`${test} ${typeof test}`); + console.log(`${test}`); } }