/*
1/ не менее двумя способами сделать так, чтобы num стал типа Number
*/
/*
var str = "5";
var num = str;
//var num = +str;//1 способ
var num=Number(str);//2 способ
console.log(num);
console.log(typeof num);
*/
/*
2/Сейчас он выводит результат: 51 Используя только скобки, сделать так, чтобы c = 30
*/
/*
var a = 20,
b = 11;
var c = a+(++b*3-6)/3;//20+10=30
console.log(c);
*/
/*
3/ Написать функцию, которая создаёт массив указанной длины,
заполняет его случайными числами, которые находятся в диапазоне чисел,
которые также указывает пользователь и возвращает нам этот массив:
*/
/*
var massValue=+prompt('Введите размерность массива', '');
function createArray(value){
var mass=new Array(massValue);
console.log(mass);
console.log(mass.length);
var min=+prompt('Введите минимальное значение', '');
var max=+prompt('Введите максимальное значение', '');
for(var i=0; i<mass.length; i++){
mass[i]=minmaxValue(min,max);
}
console.log(mass);
return mass;
}
function minmaxValue(min,max){
var rand=Math.random() * (max - min) + min;
rand=Math.round(rand);
return rand;
//console.log(mass);
}
createArray(massValue);
*/
/*
4/
Пенсионный калькулятор
*/
/*
var input = document.getElementById('zd_pensia');
input.addEventListener('blur', pensia);
function pensia(){
var stag=0;
stag=input.value;
testInput(stag);
console.log(stag);
resultPensia(stag);
}
function testInput(value){
if(!Number(value)){
alert('НеЧисло');
console.log(value);
console.log(typeof(value));
var reg=/\d+/;//поиск до первого числа в строке
var result=Number(value.match(reg));
if(result==0 ||result==null){
alert('Повторите ввод');
console.log('fatal' + '' + result); //при вводе строки вида ggfbtyhh отработало
input.value='';
}
else{
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.