Where is the error in JS code (Yandex.Workshop)?

I have a question about the 5-th course 19 lesson.
Condition: Now we give the function makeColorString(r,g,b) in working condition. Need in the body of the function, replace all variable names red, green and blue parameters r, g and b, respectively.
When checking this code, an error is displayed and the message:
"It is necessary to replace the variable name with the red r inside makeColorString()."
Please indicate where is the error.

checkInput(red);
checkInput(green);
checkInput(blue);
makeColorString function(r, g, b) {
// red
if (isNaN(red)) {
 red = prompt('as the saturation value of the red you entered is not a number. Please enter a number from 0 to 255.', '255');
} 
else if (red < 0) { 
 console.log("the Smallest possible numbers — the zero, we have set the value to 0.");
} 
else if (red > 255) { 
 console.log('the Highest number is 255, we set him up.');
} 
else{
 red = console.log('You define saturation as the red' + red) 
}
console.log(isNaN(red));

}
var red, green, blue;
var bgValue = 'rgb(' + red + ', ' + green + ', ' + blue + ')';
console.log(bgValue);
var red = prompt ('Enter saturation of red in the form of numbers from 0 to 255', '255');
var green = prompt ('Enter the intensity of green in the form of numbers from 0 to 255', '0');
var blue = prompt ('Enter the amount of blue as a number from 0 to 255','0');
var red = NaN
makeColorString();
// CheckInput
function checkInput(i){
 i = Number(i);
if (isNaN(i)) {
 i = prompt('as the saturation value of the color you entered is not a number. Please enter a number from 0 to 255.', '255');
 i = Number(i);
} 
else if (i < 0) { 
 i = 0;
 console.log("the Smallest possible numbers — the zero, we have set the value to 0.");
} 
else if (i > 255) { 
 i = 255;
 console.log('the Highest number is 255, we set him up.'); }
}


If makeColorString(); add at least one r all the same an error is displayed (same).
March 19th 20 at 09:08
2 answers
March 19th 20 at 09:10
makeColorString function(r, g, b) {
var red;
if (isNaN(r)) {
 red = prompt('as the saturation value of the red you entered is not a number. Please enter a number from 0 to 255.', '255');
} 
else if (r< 0) { 
 console.log("the Smallest possible numbers — the zero, we have set the value to 0.");
} 
else if (r > 255) { 
 console.log('the Highest number is 255, we set him up.');
} 
else{
 red = console.log('You have identified the saturation of red as' + r) 
}
console.log(isNaN(red));

}
Out error : you Must replace the variable name with the red r inside makeColorString(). - rebeca50 commented on March 19th 20 at 09:13
makeColorString function(r, g, b) {
if (isNaN(r)) {
 r = prompt('as the saturation value of the red you entered is not a number. Please enter a number from 0 to 255.', '255');
} 
else if (r< 0) { 
 console.log("the Smallest possible numbers — the zero, we have set the value to 0.");
} 
else if (r > 255) { 
 console.log('the Highest number is 255, we set him up.');
} 
else{
 r = console.log('You have identified the saturation of red as' + r) 
}
console.log(isNaN(r));

}
- buddy_Gerla commented on March 19th 20 at 09:16
March 19th 20 at 09:12
var red = prompt('Enter the intensity of the color as a number from 0 to 255', 255);
var green = prompt('Enter the intensity of green in the form of numbers from 0 to 255', 0);
var blue = prompt('Enter the amount of blue as a number from 0 to 255', 0);
checkInput(red);
checkInput(green);
checkInput(blue);
makeColorString(r,g,b);
makeColorString function(r,g,b){
var bgValue = "rgb" + "(255, 0, 0)";

console.log(red + green + blue);
console.log(red + blue);
console.log(isNaN(red));
}

function checkInput(i){
i = Number(i);
if (isNaN(i)) {
i = prompt('as the saturation value of the color you entered is not a number. Please enter a number from 0 to 255.', 255);
i = Number(i);
} else if(i < 0) {
i=0;
console.log('the Smallest possible numbers — the zero, we have set the value to 0.');
}else if(i > 255) {
i=255;
console.log('the Smallest possible numbers — the zero, we have substituted a value of 255.');
} else {
console.log('You have identified the color saturation as' + i);
}
}

Find more questions by tags YandexJavaScript