Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esbonio.sphinx.confDir": ""
}
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;


60 changes: 59 additions & 1 deletion first-code/hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,62 @@ console.log( newArrays );

const arraySplice = ['a', 'b', 'c', 'e', 'f'];
arraySplice.splice(1, 4); //deleted e
console.log( arraySplice );
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
17 changes: 17 additions & 0 deletions first-code/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ <h4>Review title</h4>
</div>
<div class="crf-footer--copyright text-primary">@Pluralsight 2018</div>
</footer>
<input type="file" id="myFileUpload">
<button onclick="uploadFile()">Upload</button>
<input type="file" id="myFileUpload">
<button onclick="readFile()">Read file</button>
<script>
function readFile() {
var input = document.getElementById("myFileUpload");
var file = input.files[0];
if (file) {
var reader = new FileReader();
reader.readAsText(file);
reader.onload = function() {
console.log(reader.result);
};
}
}
</script>
</div>
<script src="./utils.js"></script>
<script src="./hello.js"></script>
Expand Down
21 changes: 21 additions & 0 deletions test.rst
Original file line number Diff line number Diff line change
@@ -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