Explorar o código

Classwork multiply done

Olga_Brekhuntsova %!s(int64=2) %!d(string=hai) anos
pai
achega
df2cbc0352

+ 104 - 0
classwork-table-array/.gitignore

@@ -0,0 +1,104 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+*.lcov
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# TypeScript cache
+*.tsbuildinfo
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Microbundle cache
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# Next.js build output
+.next
+
+# Nuxt.js build / generate output
+.nuxt
+dist
+
+# Gatsby files
+.cache/
+# Comment in the public line in if your project uses Gatsby and *not* Next.js
+# https://nextjs.org/blog/next-9-1#public-directory-support
+# public
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# TernJS port file
+.tern-port

+ 12 - 0
classwork-table-array/.prettierrc.json

@@ -0,0 +1,12 @@
+{
+    "printWidth": 80,
+    "tabWidth": 2,
+    "useTabs": false,
+    "semi": true,
+    "singleQuote": true,
+    "trailingComma": "all",
+    "bracketSpacing": true,
+    "jsxBracketSameLine": false,
+    "arrowParens": "avoid",
+    "proseWrap": "always"
+  }

+ 2 - 0
classwork-table-array/README.md

@@ -0,0 +1,2 @@
+# JS-1
+Hometask-1

+ 13 - 0
classwork-table-array/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="ru">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>JS-classwork-array</title>
+  </head>
+  <body>
+ <script src="/js/task-sum-array.js" type="module"></script>
+ <script src="/js/table.js" type="module"></script>
+  </body>
+</html>
+

+ 19 - 0
classwork-table-array/js/table.js

@@ -0,0 +1,19 @@
+// task-table
+let i;
+let j;
+
+const array = [i, j];
+
+let str = "<table>";
+for (i = 1; i <10; i++) {
+    str += "<tr>";
+    for (j = 1; j < 10; j++) {
+        str += "<td style='width:70px'>" + i +"*"+j+"="+ i * j + "</td>";
+    }
+    str += "</tr>";
+}
+str +="</table>";
+document.body.insertAdjacentHTML("afterbegin", str);
+
+
+

+ 6 - 0
classwork-table-array/js/task-sum-array.js

@@ -0,0 +1,6 @@
+// task-sum-array
+let arr = [1, 2, 3, 4,10];
+let sum = 0;
+for (let item of arr) { sum = sum+item };
+// console.log(arr.concat(sum));
+console.log([...arr,sum]);