diff --git a/1-Javascript Fundamentals/code/operators.js b/1-Javascript Fundamentals/code/operators.js index e69de29..6b27788 100644 --- a/1-Javascript Fundamentals/code/operators.js +++ b/1-Javascript Fundamentals/code/operators.js @@ -0,0 +1,47 @@ + +//ARTHAMATIC OPERATIONS>>>>>>>> +5+2 // 7 addition; + +5-1 // 4 subraction; + +2*2 // 4 multiply; + +54 % 5 // 4 modula; + +5/4 // 1.25 // division; + +//STRING OPERATIONS>>>>>>>>>>>> + +'teja ' + 'nayak' // teja nayak + +"teja" + "nayak" // tejanayak + +//NAN OPERATIONS>>>>>>>>>>>>>>>> +NaN == NaN // false; + +NaN === NaN // false // NaN Stands for (Not A Number); + +'Teja' * 'Nayak' // NaN; + +Number.isNaN (1000) // false; + +Number.isNaN (NaN) // true; + +Number.isNaN ('teja') // false; + +Number.isNaN (45*65) // false; + +Number.isNaN (true) // false; + +Number.isNaN (false) // false; + +'5' + 5 // '55'; + +'5'+'5' //'55'; + +String (45+45) //'90' + +Number (45+45) //'90'; + +String (45+45) //'90' + diff --git a/2-Javascript-Functions/1.High-order-return-function-arthamatic-operations.js b/2-Javascript-Functions/1.High-order-return-function-arthamatic-operations.js new file mode 100644 index 0000000..c9f7684 --- /dev/null +++ b/2-Javascript-Functions/1.High-order-return-function-arthamatic-operations.js @@ -0,0 +1,45 @@ +function arithmeticOpeartions(operation){ + if(operation === '+'){ + return function(a,b){ + return a+b; + } + }else if(operation === '-'){ + return function(a,b){ + return a-b; + } + }else if(operation === '*'){ + return function(a,b){ + return a*b; + } + }else if(operation === '/'){ + return function(a,b){ + return a/b; + } + }else if(operation === '%'){ + return function(a,b){ + return a%b; + } + }else return function(a,b){ + return 0; + } +}; + +const addfunction = arithmeticOpeartions('+'); +const multiplyfunction = arithmeticOpeartions('*'); +const subractfunction = arithmeticOpeartions('-'); +const divisionfunction = arithmeticOpeartions('/'); +const modulefunction = arithmeticOpeartions('%'); + +const result1 = addfunctionarithmeticOpeartions(85,960);//1045 +const result2 = multiplyfunction(852,963);//820476 +const result3 = subractfunction(852,963);//-111 +const result4 = divisionfunction(852,963);//0.8847352024922118 +const result5 = modulefunction(852,963);//852 + +console.log(result1); +console.log(result2); +console.log(result3); +console.log(result4); +console.log(result5); + +