JSFiddle - React, Tailwind, and code Playground

by LuckyCat

JavaScript

// 1\task02

'use strict';
/*
  // Написать функцию, которая принимает строку, а возвращает строку без первого и последнего символа
  function funcName(str) {

  }

  Например: 
  funcName('eloquent'), 'loquen'
  funcName('country'), 'ountr'
  funcName('person'), 'erso'
  funcName('place'), 'lac'
*/

// 1
function funcName1(arr) {
  var minValue = Math.min(...arr);
  console.log("Should return the smallest int " + minValue);
  return minValue;
}
funcName1([78,56,232,12,8]); // ,8,'Should return the smallest int 8');
funcName1([78,56,232,12,18]); //,12,'Should return the smallest int 12');
funcName1([78,56,232,412,228]);// ,56,'Should return the smallest int 56');
funcName1([78,56,232,12,0]); //,0,'Should return the smallest int 0');
funcName1([1,56,232,12,8]); //,1,'Should return the smallest int 1');

// 2
function funcName2(arr) {
  var minValue = Math.min.apply(null, arr);
  console.log("Should return the smallest int " + minValue);
  return minValue;
}
funcName2([78,56,232,12,8]); // ,8,'Should return the smallest int 8');
funcName2([78,56,232,12,18]); //,12,'Should return the smallest int 12');
funcName2([78,56,232,412,228]);// ,56,'Should return the smallest int 56');
funcName2([78,56,232,12,0]); //,0,'Should return the smallest int 0');
funcName2([1,56,232,12,8]); //,1,'Should return the smallest int 1');