����� 2
�� 3: ���� ���������.
��� ����� ��� �����, �� ����� ����� ��� ������ (������ �� ������) ����� ������. ��� ��� ������� ������ ���� ������ �����, �� �� ������ ����� �������. �����, ������ ���� ��� �����:
var nice_monkey = "The monkey smiles at you and recites Shakespeare.";
var bad_monkey = "The monkey scowls at you and burps.";
����� ������ ��� ���� Javascript ������ �� ������� nice_monkey �- bad_monkey ������ �� ���� ����� �������� �������. ���� ����� ��� ���� �����: document.writeln(nice_monkey); ��� ��� ����� �- Javascript ����� �� ������ ������ ����� ������ �� ����� ������.
��� ����� ��� ����� ����� �� �������. ���� ����� ���� ����� �� ����� ��, ����� �� ������ ��������� �� ��� ��.
���� ����� ����� ����:
var monkey = prompt("What's the monkey's name?", "The monkey");
����� �� ��� ����� ����� ��� ����� �������. ���� ��� ����� ����� ������ prompt, ��� ����� ���� ������ ������ ������ ��� �������. ���� ������� ���� �� ����� OK ������ ������ ���� �� �� ������ ����� ����� ����. ����� ��� ��� ����� ���� ����� ������� ����� ���� ������ monkey.
���� ��, �� ����� prompt ����� ��� �������, ����� �������. ���� ���� �� ���� ������ ����� �������, ����� ��: "What's the monkey's name?". ����� "The monkey" ������ ��, ���� ��� ����� ���� �� ���� ���� (���� ������ ����� ������� �� ����� ���). �� ��� ������ ����� ��� ����� ����, ���� ���� ������ ���� ("") ������ ����, ��:
var monkey = prompt("What's the monkey's name?", "");
������ ��"� �� ���� ����� ������� � ��� ���� ��� ������. ��"� ��� ������ ����� ����:
var techy_monkey = monkey + demanding + tech;
���� �� ����� ������ ����� ������ ����: ���� �����. ���� �� ������ ����� ��� ��� ������� �� ��� ������ ������� ������� ������ ��� ������ ������ (���� ���� ����).�� ����� �� ����� ����� ��� ��� techy_monkey ����� ������ ���� ���� ������ ������ �� ����� ������ (������� �������). ����� ��: "The monkey" + "demands, no insists upon receiving" + "a computer that won't crash, and a homemade browser!". ������ �����, ���� ���� �������:
var techy_monkey = monkey + demanding + tech;
����� ��, ��� ����� ��� �����:
var techy_monkey = "The monkey demands, no, insists upon receiving a computer that won't crash, and a homemade browser!";
������ ����� ���� ��� ����� ������� ����� ���� �� �������. �� ������� ������ ������ �����, ���� ����� �� ������ �����, ������ ���� ����:
var italic_hippy = hippy_monkey.italics();
var shouting_hippy= hippy_monkey.toUpperCase();
var red_bold_tech = bold_tech.fontcolor('red');
������� ���� ����� ������ �����, ����� �� ������� ����� ������ hippy monkey ������ ���� ����� ������ (��� ����). �� ��� ��� �����:
var italic_hippy = "<i>" + hippy_monkey + "</i>";
�� ����� ���� ���� ��� ����. ��� ����, ������� ��"�: (document.writeln (italic_hippy ���� �- Javascript, ���� �� ������� �- hippy_monkey ����� ������.
����� ������ ������, ������� �� shouting_hippy, ���� ���� ��� ���� ���� ������� ��� HTML ����. ��� ����� �� �� ��� ������ hippy_monkey ������ �� �� ������� ������� ������ (������� � uppercase letters).
����� ������� ������, ����� ����� ������ ������� ������. ��� ������ �� ��� ��������� ������ �"� ����� ������:
string.fontcolor('new color');
var red_bold_tech = "<font color='red'>" + bold_tech + "</font>";
var red_bold_tech = bold_tech.fontcolor('red');
���� ��� ������ �� ��� ����� ��:
document.writeln(bold_tech + "<br>");
�� ���� ����� ������� ��� ������ ������ ���� ������ �� ������� ��� ������� ��� ������� ��� �� �������� �� ������. ������ ����� ��� �� �"� ����� ���� ����� ��� ����� ������ ����:
var broken_bold = bold_tech + "<br>";
document.writeln(broken_bold);
��� �� ���� ������ ����� ����, ������ ���� ���� ������ ���� ���� �����.
���, ������ ��� ����� ������ ��������, ���� ���� ������ �����.
��� �� ����� ��� ���, �� ��� ����� �� ����� ������� ������� ���.
���� ������ ���
��� ��� «--
|