Function Playground

Post your functions here!

function findStringLength(string1) {
    console.log(string1);
    console.log(string1.length);
}

SmartSelect_20220122-120935_Brave
This code function will print out your name, gender, and age.

var Person = (name, gender, age) => {
    console.log('Hello there!');
    console.log('My name is ' + (name + '!'));
    console.log('I am a ' + (gender + '.'));
    console.log('I am ' + (age + ' years old!'));
    if (age <= 5) {
        console.log('I am a baby.');
    }
    if (age > 5 && age < 13) {
        console.log('I\'m a big ' + (gender + ', now!'));
    }
    if (age >= 13 && age < 18) {
        console.log('I\'m a teenager, now!');
    }
    if (age >= 18 || age >= 25) {
        console.log('I am an adult, now!');
    }
};
1 Like