Created
March 29, 2021 10:23
-
-
Save Joshmatjjen/969a74aaa38d2688c9cff9ac0f55897a to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/qocahaj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
/*** TESK 1 **/ | |
// // ES5 | |
// function calRadOfCircle(radius, type) | |
// { | |
// if(radius && type) { | |
// // area method | |
// const area = Math.PI * radius * radius; | |
// // perimeter method | |
// const perimeter = 2*Math.PI*radius; | |
// return type === "area" ? area.toFixed(2) : type === "perimeter" ? perimeter.toFixed(2) : "Please input a valid type" ; | |
// } else { | |
// return "No radius inputed" | |
// } | |
// } | |
// var c = circle(3, "perimeer"); | |
// console.log(`Area = ${c}`); | |
// ES6 | |
const calRadOfCircle = (radius, type) => { | |
if(radius && type) { | |
// area method | |
const area = () => | |
{ | |
return Math.PI * radius * radius; | |
}; | |
// perimeter method | |
const perimeter =() => | |
{ | |
return 2*Math.PI*radius; | |
}; | |
// console.log(area().toFixed(2)) | |
return type === "area" ? area().toFixed(2) : type === "perimeter" ? perimeter().toFixed(2) : "Please input a type" ; | |
} else { | |
return "No radius inputed" | |
} | |
} | |
console.log(calRadOfCircle(10, "area")); | |
/**** TESK 2 ***/ | |
// ES5 | |
// function checkStringCase(word){ | |
// if(word) { | |
// if(word.charAt(0) === word.charAt(0).toUpperCase()) { | |
// return true | |
// } else { | |
// return false; | |
// } | |
// }else { | |
// return 'Please input word'; | |
// } | |
// } | |
// console.log(checkStringCase("Josh")) | |
// ES6 | |
const checkStringCase = (word) => { | |
return word ? word.charAt(0) === word.charAt(0).toUpperCase() : 'Please input word' | |
} | |
console.log(checkStringCase("Joshmat")); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">/*** TESK 1 **/ | |
// // ES5 | |
// function calRadOfCircle(radius, type) | |
// { | |
// if(radius && type) { | |
// // area method | |
// const area = Math.PI * radius * radius; | |
// // perimeter method | |
// const perimeter = 2*Math.PI*radius; | |
// return type === "area" ? area.toFixed(2) : type === "perimeter" ? perimeter.toFixed(2) : "Please input a valid type" ; | |
// } else { | |
// return "No radius inputed" | |
// } | |
// } | |
// var c = circle(3, "perimeer"); | |
// console.log(`Area = ${c}`); | |
// ES6 | |
const calRadOfCircle = (radius, type) => { | |
if(radius && type) { | |
// area method | |
const area = () => | |
{ | |
return Math.PI * radius * radius; | |
}; | |
// perimeter method | |
const perimeter =() => | |
{ | |
return 2*Math.PI*radius; | |
}; | |
// console.log(area().toFixed(2)) | |
return type === "area" ? area().toFixed(2) : type === "perimeter" ? perimeter().toFixed(2) : "Please input a type" ; | |
} else { | |
return "No radius inputed" | |
} | |
} | |
console.log(calRadOfCircle(10, "area")); | |
/**** TESK 2 ***/ | |
// ES5 | |
// function checkStringCase(word){ | |
// if(word) { | |
// if(word.charAt(0) === word.charAt(0).toUpperCase()) { | |
// return true | |
// } else { | |
// return false; | |
// } | |
// }else { | |
// return 'Please input word'; | |
// } | |
// } | |
// console.log(checkStringCase("Josh")) | |
// ES6 | |
const checkStringCase = (word) => { | |
return word ? word.charAt(0) === word.charAt(0).toUpperCase() : 'Please input word' | |
} | |
console.log(checkStringCase("Joshmat")); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** TESK 1 **/ | |
// // ES5 | |
// function calRadOfCircle(radius, type) | |
// { | |
// if(radius && type) { | |
// // area method | |
// const area = Math.PI * radius * radius; | |
// // perimeter method | |
// const perimeter = 2*Math.PI*radius; | |
// return type === "area" ? area.toFixed(2) : type === "perimeter" ? perimeter.toFixed(2) : "Please input a valid type" ; | |
// } else { | |
// return "No radius inputed" | |
// } | |
// } | |
// var c = circle(3, "perimeer"); | |
// console.log(`Area = ${c}`); | |
// ES6 | |
const calRadOfCircle = (radius, type) => { | |
if(radius && type) { | |
// area method | |
const area = () => | |
{ | |
return Math.PI * radius * radius; | |
}; | |
// perimeter method | |
const perimeter =() => | |
{ | |
return 2*Math.PI*radius; | |
}; | |
// console.log(area().toFixed(2)) | |
return type === "area" ? area().toFixed(2) : type === "perimeter" ? perimeter().toFixed(2) : "Please input a type" ; | |
} else { | |
return "No radius inputed" | |
} | |
} | |
console.log(calRadOfCircle(10, "area")); | |
/**** TESK 2 ***/ | |
// ES5 | |
// function checkStringCase(word){ | |
// if(word) { | |
// if(word.charAt(0) === word.charAt(0).toUpperCase()) { | |
// return true | |
// } else { | |
// return false; | |
// } | |
// }else { | |
// return 'Please input word'; | |
// } | |
// } | |
// console.log(checkStringCase("Josh")) | |
// ES6 | |
const checkStringCase = (word) => { | |
return word ? word.charAt(0) === word.charAt(0).toUpperCase() : 'Please input word' | |
} | |
console.log(checkStringCase("Joshmat")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code test to Jaroczynski