This file contains 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
/* | |
Get 1 to 255 | |
Write a function that returns an array with all the numbers from 1 to 255. You may use the push() function for this exercise. | |
*/ | |
function get_array() { | |
var arr = []; | |
//your code here | |
for(var i=1; i<256; i++){ | |
arr.push(i); | |
} |
This file contains 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 computerChoiceFunc = function(){ | |
var compChoice = Math.random(); | |
if (compChoice < 0.34) { | |
compChoice = "rock"; | |
} else if(compChoice <= 0.67) { | |
compChoice = "paper"; | |
} else { | |
compChoice = "scissors"; | |
} | |
console.log("computer: "+ compChoice); |
This file contains 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
body { | |
font-family: sans-serif; | |
} | |
#controlPanel { | |
float: left; | |
padding-top: 30px; | |
} | |
.button { |
This file contains 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
/** | |
* Implement function with 1 argument typeof <Array> | |
* 1. function should delete all duplicating elements | |
* 2. function should remove all not Number values | |
* 3. function should sort array from the largest to the smallest number. | |
* For example: given array [1, 1, 3, 2, 'qwe', 6, true, 4, 2], result function should return [6, 4, 3, 2, 1] | |
*/ | |
var arrayNotSorted = ['ggg', 'rtty', 1, 1, 1, 3, 2, 6, true, 4, 2];//I added few elements | |
var arraySorted; // If we like to save the incoming data |
This file contains 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
//Objects | |
var literalObject = { | |
name: "literalObject", | |
property1: "some data", //string | |
property2: 3, // number | |
property3: [], //array | |
property4: {}, | |
method1: function(){ | |
var result = []; | |
for (var prop in this) { |
This file contains 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
body { | |
font-family: helvetica, sans-serif; | |
margin: 0 auto; | |
/*max-width: 600px;*/ | |
background: #232323; | |
} | |
div { | |
height: 200px; | |
background-size: cover; | |
position: relative; |
This file contains 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
header { | |
text-align: center; | |
background: url('http://gorbachenko.byethost18.com/assets/blog_bg2.png'); | |
background-size: cover; | |
color: white; | |
} | |
a { | |
text-decoration: none; | |
color: white; | |
} |
This file contains 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
body { | |
text-align: center; | |
background: #5c5c5c url("http://gorbachenko.byethost18.com/assets/background_picture.png") ; | |
background-size: cover; | |
background-position: center top left; | |
color: white; | |
font-family: helvetica; | |
} | |
p { | |
font-size: 22px; |
This file contains 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
function SLL(){ | |
this.head = null; | |
} | |
function Node(val){ | |
this.val = val; | |
this.next = null; | |
} |
This file contains 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
// O(log(n)) - time complexity | |
// O(n) - space complexity | |
function binarySearch(arr,val){ | |
if (arr.length === 0){return -1;} | |
var li = 0; | |
var hi = arr.length-1; | |
while(li<=hi){ | |
var mid = Math.floor(li+(hi-li)/2); |
OlderNewer