Skip to content

Instantly share code, notes, and snippets.

@h4
Created March 20, 2012 13:45
Show Gist options
  • Save h4/2135753 to your computer and use it in GitHub Desktop.
Save h4/2135753 to your computer and use it in GitHub Desktop.
Основные типы данных в JS
/*
Основные типы данных в JS
*/
var sampleNumber,
anotherNumber,
sampleString,
anotherString,
itIsTrue,
itIsNotTrue,
strangeVariable,
sampleObject;
// Простые типы данных
// number — Числа
sampleNumber = 2;
anotherNumber = 3.14;
// string – строки
sampleString = "JS is my favorite language";
anotherString = 'I don\'t understand';
// boolean - логические значения
itIsTrue = true;
itIsNotTrue = false;
strangeVariable = undefined;
// Составной тип данных - объект
sampleObject = {
name: "Olaf",
age: 18,
getName: function() {
return this.name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment