Skip to content

Instantly share code, notes, and snippets.

@ValentynaGorbachenko
ValentynaGorbachenko / array_dups_sort.js
Created October 4, 2016 21:35
array_dups_sort created by ValentynaGorbachenko - https://repl.it/DoVE/1
/**
* 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
@ValentynaGorbachenko
ValentynaGorbachenko / index.css
Created October 4, 2016 21:32
TraficLight created by ValentynaGorbachenko - https://repl.it/DoVS/0
body {
font-family: sans-serif;
}
#controlPanel {
float: left;
padding-top: 30px;
}
.button {
@ValentynaGorbachenko
ValentynaGorbachenko / RockPaperScissors.js
Created October 4, 2016 21:31
RockPaperScissors created by ValentynaGorbachenko - https://repl.it/DoVZ/0
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);
@ValentynaGorbachenko
ValentynaGorbachenko / CodingDojo-Challenges.js
Created October 4, 2016 20:46
CodingDojo-Challenges created by ValentynaGorbachenko - https://repl.it/C3o9/1
/*
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);
}