Skip to content

Instantly share code, notes, and snippets.

@mandaputtra
Created November 7, 2021 09:51
Show Gist options
  • Save mandaputtra/80729d47f7971ef69ec68373261bc961 to your computer and use it in GitHub Desktop.
Save mandaputtra/80729d47f7971ef69ec68373261bc961 to your computer and use it in GitHub Desktop.
// print a name
function sayHello(name) {
console.log(`Hallo ${name} (^▽^)`)
}
// check if number are odd or even
function oddOrEven(num) {
if (num % 2 === 0) {
console.log('Genab')
} else {
console.log('Ganjil')
}
}
// be a calculator
function areaOfCircle(num) {
console.log(Math.PI * num * num)
}
// program to count the number of vowels in a string
function countVowel(str) {
// find the count of vowels
const count = str.match(/[aeiou]/gi).length;
// return number of vowels
console.log(count)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment