diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a7d0fc7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "esbonio.sphinx.confDir": "" +} \ No newline at end of file diff --git a/README.md b/README.md index 9392d19..95ba3fb 100644 --- a/README.md +++ b/README.md @@ -113,4 +113,17 @@ values = ['1','2']; newValue = values.slice(1)// 1 only ``` -splice +Array searching and looping +--------------------------- + +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach + +* array in DOM: + +variables +--------- +global +functional +use strict; + + diff --git a/first-code/hello.js b/first-code/hello.js index 179be58..e3a09b0 100644 --- a/first-code/hello.js +++ b/first-code/hello.js @@ -88,4 +88,62 @@ console.log( newArrays ); const arraySplice = ['a', 'b', 'c', 'e', 'f']; arraySplice.splice(1, 4); //deleted e -console.log( arraySplice ); \ No newline at end of file +console.log( arraySplice ); + +function uploadFile() { + var input = document.getElementById("myFileUpload"); + var file = input.files[0]; + var formData = new FormData(); + + formData.append("file", file); + + var xhr = new XMLHttpRequest(); + xhr.open("POST", "/upload"); + xhr.send(formData); + } + + function readFile() { + var input = document.getElementById("myFileUpload"); + var file = input.files[0]; + if (file) { + var reader = new FileReader(); + reader.readAsText(file); + reader.onload = function(event) { + var contents = event.target.result; + console.log(reader.result); + alert(contents); + var fileContentsElement = document.getElementById("fileContents"); + fileContentsElement.textContent = contents; + }; + reader.readAsText(file); + }} + +const searchValues = ["a", "b", "c", "d"]; +console.log(searchValues.indexOf('c')); // 2 +console.log(searchValues.indexOf('f')); // -1 non exist values + +const searchSet = searchValues.filter(function(item){ + return item > 'b'; // c, d +}); +console.log(searchSet); + +const findValues = ["a", "bbbb", "c", "d"]; +const findSet = findValues.find(function(item){ + return item.length > 1; // b +}); +console.log(findSet); + +findValues.forEach(function(item) { + console.log(item); + +}); + +const container = document.getElementsByClassName('container'); + +console.log(container); +container[2].classList.add('d-none'); //remove picture of boots + +'use strict'; + +product = 126; +console.log(product); //error because of use strict \ No newline at end of file diff --git a/first-code/index.html b/first-code/index.html index f95f39e..8cf999f 100644 --- a/first-code/index.html +++ b/first-code/index.html @@ -203,6 +203,23 @@

Review title

+ + + + + diff --git a/test.rst b/test.rst new file mode 100644 index 0000000..ce44cd8 --- /dev/null +++ b/test.rst @@ -0,0 +1,21 @@ +My Document +========= +Paragraphs: +This is a paragraph. +Lists: + +- Item 1 +- Item 2 +- Item 3 +Tables: +.. table:: My Table + ++--------+--------+ +| Header | Header | ++========+========+ +| Cell 1 | Cell 2 | ++--------+--------+ +Directives: +.. figure:: my_image.png + :alt: My Image + :align: cent \ No newline at end of file