Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Угадай число с подсказками

Читайте также:
  1. Gramadach 14.1 Ирландские склонения. Множественное число
  2. I. Порядок поступления в число присяжных поверенных
  3. Quot; Число, месяц, часы, минуты.Дежурство принял ДСП ……………..(подпись)Оператор ………………………..(подпись)Дежурство сдал ДСП ……………….(подпись)Оператор ………………………..(подпись)".
  4. quot;Угадай мелодию" с конфетами.
  5. А46. Кратно увеличенное по отношению к гаплоидному набору (2n, 3n, 4n, и т.д.) число хромосом называется
  6. Активность А радиоактивного вещества – число спонтанных ядерных превращений в этом веществе в единицу времени.
  7. Более или менее грамотными, они вошли в число немногих

function guessNumber(number, clue) {

// Prompt the user for a number using the string value of clue

guess = prompt(clue);

// Convert their guess to a number using +

guess = +guess;

 

while (guess!== number) {

if (guess < number) {

guess = prompt("Too low. Guess again.");

}

else if (guess > number) {

guess = prompt("Too high. Guess again.");

}

guess = +guess;

}

 

console.log("You got it! The number was " + number);

}

guessNumber(36,"Pick a number between 1 and 100");

_____________________________________________________________________________________

// This evaluates to 'true'. This is because the first operand

// is true, so it is immediately returned. The second operand

// is never evaluated.

true || false;

 

// This evaluates to 'true'. This is because the first operand

// is false, so the second operand is returned. In this case,

// the second operand must be evaluated.

false || true;

 

// This evaluates to false. Since the first operand is false,

// the second operand is not even evaluated.

false && true;

 

// This evaluates to false. Since the first operand is true,

// the second operand is evaluated. Since this is false, the

// statement evaluates to false.

true && false;

• indexOf() Searches for the first occurrence of a character or substring.
• lastIndexOf()
Searches for the last occurrence of a character or substring.

function contains(str, substr) {

if (str.indexOf(substr) >=0) {

return true;

}

else{

return false;

}


Дата добавления: 2015-08-17; просмотров: 41 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
ASSOCIATIVE ARRAYS| КАМЕНЬ, НОЖНИЦЫ, БУМАГА

mybiblioteka.su - 2015-2024 год. (0.008 сек.)