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
| see below :) |
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
| var arr = [1, -2, 3, 0]; | |
| var max = Math.max.apply(Math, arr); | |
| console.log(max) // 3 |
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
| var text = document.getElementById('text'); // <div id="text"></div> | |
| var quotes = '["1", "2", "3"]'; // any array (JSON or not JSON) | |
| quotes = JSON.parse(quotes); | |
| text.onclick = function foo() { | |
| var random = parseInt(Math.random()*quotes.length); | |
| var quote = quotes[random]; | |
| if(text.innerHTML == quote) { | |
| return foo(); // start the function again |
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
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', 'https://kuznetsovandrey76.github.io/chingu-map/data.json'); | |
| xhr.send(); | |
| xhr.onload = function() { | |
| console.log('answer:' + xhr.response); | |
| }; |
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
| January 2017 |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link href="https://fonts.googleapis.com/css?family=Antic|Dosis|Exo|Josefin+Sans|Maven+Pro|Muli:300|Nobile|Oxygen:300|Poppins:300|Raleway|Ruluko" rel="stylesheet"> | |
| <title>Fonts</title> | |
| <style> | |
| * { | |
| margin: 0; |
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
| var div = document.querySelectorAll('div'), | |
| result; | |
| for (var i = 0; i < div.length; i++) { | |
| result = div[i]; | |
| result.addEventListener('click', function() { | |
| alert(this.innerHTML); | |
| }); | |
| } |
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
| var arr = [ | |
| [1,2], | |
| [3,4], | |
| [5,6] | |
| ]; | |
| var temp = []; | |
| for (var i = 0; i < arr.length; i++) { | |
| temp.push(arr[i][0], arr[i][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
| // HTML | |
| <div id="first" class="content"></div> | |
| <div id="second" class="content"></div> | |
| //JS | |
| var first = document.querySelector("#first"); | |
| var second = document.querySelector("#second"); | |
| var clickedLink = { | |
| first: 0, |
OlderNewer