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 object = {}; | |
var params = ['paramOne', 'paramTwo', 'paramThree']; | |
for (var i=0; i<params.length; i++){ | |
object[params[i]] = i; | |
} | |
var paramName = "customParam"; | |
object[paramName] = 'LOL'; |
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
//--------------- ПРИМЕР 1 ------------------// | |
function Something() { | |
}; | |
var somethingObject = new Something(); | |
console.log(somethingObject instanceof Something); | |
//--------------- ПРИМЕР 2 ------------------// |
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 fibonacci(n) { | |
if ((n==1)||(n==2)){ | |
return 1; | |
} | |
else if (n > 0){ | |
return fibonacci(n-1) + fibonacci(n-2); | |
} else { | |
return -1; | |
} | |
} |
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
//--------------------- ПРИМЕР 1 ------------------------// | |
var glassCount = 4; | |
console.log('glassCount = ' + glassCount); | |
glassCount = glassCount - 1; | |
console.log('glassCount - 1 = ' + glassCount); | |
var glassFloatCount = 4.5; | |
console.log('glassFloatCount = ' + glassFloatCount); |
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
//----------------------- ПРИМЕР 1 --------------------------// | |
var firstGlass = {volume: 0.9, drink: 'коньяк', isOnTable: true}; | |
var secondGlass = {volume: 0.1, drink: 'неопознанная жидкость', isOnTable: false}; | |
var thirdGlass = {volume: 0, drink: 'компот', isOnTable: true}; | |
var myGlass = firstGlass; //назначаем любую из переменных выше | |
if (myGlass.volume > 0.5){ | |
console.log('Выпей меня'); | |
} |
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
//-------------------- ПРИМЕР 1 ------------------------// | |
var glassArray = ['Первый стакан', 'Второй стакан', 'Третий стакан', 'Четвертый стакан']; | |
var glassCount = 0; | |
for (var index = 0; index < glassArray.length; ++index) { | |
console.log('Я считаю ' + glassArray[index] + ' счетчик равен ' + index); | |
glassCount = glassCount + 1; | |
} | |
var sayItLikeHuman = ''; |
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
//------------------------ ПРИМЕР 1 --------------------------// | |
function guessDrink(drink) { | |
var vine = {taste: "сладкий", color:"красный", alcohol: true, name: "вино"}; | |
var juice = {taste: "сладкий", color:"красный", alcohol: false, name: "сок"}; | |
var tee = {taste: "горький", color:"коричневый", alcohol: false, name: "чай"}; | |
var drinkLibrary = [vine, juice, tee]; | |
var possibleDrink; | |
var capabilityRank = 0; |
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 username = "Чубака"; | |
sayHello(username); | |
function sayHello(name) { | |
alert("Привет, " + name + "!"); | |
} |
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
<!--MY STUFF--> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script> | |
<!--END MY STUFF--> | |
<code data-gist-id="b0bed8e8110d04d48bc1ca1335ac5789"></code> | |
<code data-gist-id="1706f542c3618034129f73623dbfd6da" data-gist-highlight-line="5,6"></code> | |
<code data-gist-id="1706f542c3618034129f73623dbfd6da" data-gist-line="1-4"></code> | |
<code data-gist-id="1706f542c3618034129f73623dbfd6da" data-gist-line="8" data-gist-hide-line-numbers="true"></code> | |
<code data-gist-id="1706f542c3618034129f73623dbfd6da" data-gist-line="9" data-gist-hide-footer="true"></code> |
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Blondie Code examples</title> | |
<script src="scripts/vars.js"></script> | |
</head> | |
<body></body> | |
</html> |