let num = prompt('Введите трехзначное число');
var sum = 0;
if(isNaN(num))
alert('Ввыдите только числа');
else{
for ( let i = 0; i < num.length; i++)
sum +=parseInt(num[i]);
alert(sum);
}
function isString (obj) {
return (Object.prototype.toString.call(obj) === '[object String]');
}
function compare( a, b ) {
if((isString(a.price) && isString(b.price)) || (!isString(a.price) && !isString(b.price))){
if(a.price>b.price)
return 1;
if(a.price<b.price)
return -1;
}
if((isString(a.price) && !isString(b.price)) || (!isString(a.price) && isString(b.price)))
return isString(a.price)?-1:1
return 0;
}
function sorter(map) {
var data = [];
for (var key in map) data.push(map[key]);
data.sort(compare);
var sorted= {};
data.forEach(function (el,index) {
sorted[index]=el;
});
return sorted;
}
@app.route("/", methods=['GET', 'POST'])
def index():
if request.method == "POST":
name = request.json
print(name)
return "Hello"
<html>
<select onchange='document.getElementById("myButton1").value="Close Curtain";' onfocus="this.selectedIndex = -1;">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<input onclick="change()" type="button" value="Open Curtain" id="myButton1"></input>
</html>