Answer the question
In order to leave comments, you need to log in
Stuck on a task in Yandex.Practical JS code. What's wrong?
Task:
At the end of the script, apply a background color to the body of the HTML document, the value of which is the result of calling the makeColorString(r, g, b) function with the red, green, and blue parameters. The line with this call is now the last one in script.js.
var red = 255;
var green = 0;
var blue = 0;
var bgValue = 'rgb(' + red + ', ' + green + ', ' + blue + ')';
console.log(bgValue);
var red = prompt('Введите насыщенность цвета в виде числа от 0 до 255', '255');
var green = prompt('Введите насыщенность цвета в виде числа от 0 до 255', '0');
var blue = prompt('Введите насыщенность цвета в виде числа от 0 до 255', '0');
function checkInput(i) {
i = Number(i);
function makeColorString (r, g, b) {
var bgValue = 'rgb(' + i + ', ' + g + ', ' + b + ')';
return(bgValue);
console.log (i + b);
console.log ('Вы определили насыщенность цвета как ' + i);
}
return i
}
red = checkInput(red);
green = checkInput(green);
blue = checkInput(blue);
document.write(makeColorString(red, green, blue));
Answer the question
In order to leave comments, you need to log in
And let's just write your code with normal indents
function checkInput(i) {
i = Number(i);
function makeColorString (r, g, b) {
var bgValue = 'rgb(' + i + ', ' + g + ', ' + b + ')';
return(bgValue);
console.log (i + b);
console.log ('Вы определили насыщенность цвета как ' + i);
}
return i
}
function makeColorString (r, g, b) {
var bgValue = 'rgb(' + i + ', ' + g + ', ' + b + ')';
instead of i - r did not try? Why is i there?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question