Ad
Code
Diff
  • function helloWorld(_){
        if(_) return `Hello World baby`
        else return `No World`
    } 
    • helloWorld
    • =_=>
    • _?`Hello World baby`:`No World`
    • function helloWorld(_){
    • if(_) return `Hello World baby`
    • else return `No World`
    • }
Code
Diff
  • const sumNechet = (a, b) =>{
        let answer = 0;
        for (let index = a; index <= b; index++) {
            index % 2 == 1 ? answer += index : null;
        }
        return answer;
    } 
    console.log(sumNechet(5,15));
    • //Крюков Кирилл
    • function sumNechet(a, b) {
    • var answer = 0;
    • for (var i = a; i <= b; i++){
    • if (i % 2 != 0){
    • answer += i;
    • const sumNechet = (a, b) =>{
    • let answer = 0;
    • for (let index = a; index <= b; index++) {
    • index % 2 == 1 ? answer += index : null;
    • }
    • }
    • return answer;
    • }
    • return answer;
    • }
    • console.log(sumNechet(5,15));
Code
Diff
  • const sum = (a, b) => a+b
    • function sum(a,b) {
    • return a+b; // wrong returning
    • }
    • const sum = (a, b) => a+b
Code
Diff
  • const nums = [
      {0 : "zero"},
      {1 : "one"},
      {2 : "two"},
      {3 : "three"},
      {4 : "four"},
      {5 : "five"},
      {6 : "six"},
      {7 : "seven"},
      {8 : "eight"},
      {9 : "nine"}
    ]
    function digitToText(digit) {
        if(digit > 9 || digit < 0){
            return undefined
        }else{
            return nums[digit][digit]
        }
    }
    • const nums = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
    • const nums = [
    • {0 : "zero"},
    • {1 : "one"},
    • {2 : "two"},
    • {3 : "three"},
    • {4 : "four"},
    • {5 : "five"},
    • {6 : "six"},
    • {7 : "seven"},
    • {8 : "eight"},
    • {9 : "nine"}
    • ]
    • function digitToText(digit) {
    • return nums[digit]
    • if(digit > 9 || digit < 0){
    • return undefined
    • }else{
    • return nums[digit][digit]
    • }
    • }