This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
element.scrollIntoView({ behavior: 'smooth' }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://swapi.co/api/people/', { | |
mode: 'cors', | |
credentials: 'include' | |
}).then((res) => res.json()) | |
.then((result) => { console.log(result) }) | |
.catch((err) => { console.log(err) }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://swapi.co/api/people/', { | |
credentials: 'same-origin' | |
}).then((res) => res.json()) | |
.then((result) => { console.log(result) }) | |
.catch((err) => { console.log(err) }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://swapi.co/api/people/').then((res) => res.json()) | |
.then((result) => { console.log(result) }) | |
.catch((err) => { console.log(err) }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: 'https://swapi.co/api/people/', | |
success: data => { console.log(data); }, // [object] | |
error: err => { console.log(err) } | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const xhr = new XMLHttpRequest(); | |
xhr.open('GET', 'https://swapi.co/api/people/'); | |
xhr.responseType = 'json'; | |
xhr.onload = function() { console.log(xhr.response); }; xhr.onerror = function() { console.log("Erro"); }; | |
xhr.send(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let binarySearch = function (array, valueSearch) { | |
let start = 0; | |
let end = array.length - 1; | |
return function search(start, end) { | |
let mid = Math.round((start + end) / 2); | |
let length = end - start; | |
if (length < 0) return -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CDNs | |
//https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js | |
//https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react.js | |
//https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react-dom.min.js | |
const todo = (state = {}, action) => { | |
switch(action.type) { | |
case 'ADD_TODO': | |
return { | |
id: action.id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CDNs | |
//https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js | |
//https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react.js | |
//https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react-dom.min.js | |
const todo = (state = {}, action) => { | |
switch(action.type) { | |
case 'ADD_TODO': | |
return { | |
id: action.id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CDNs | |
//https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js | |
//https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react.js | |
//https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react-dom.min.js | |
const todo = (state = {}, action) => { | |
switch(action.type) { | |
case 'ADD_TODO': | |
return { | |
id: action.id, |