Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

        class User {
            constructor (firstName, lastName, birthday) {
                this.firstName = firstName 
                this.lastName = lastName 
                this.birthday = birthday

            getLogin() {
                let fn = this.firstName.toLowerCase();
                    fn = new Array(...fn);
                const [a, ...other] = fn;

                let ln = this.lastName.toLowerCase();
                ln = new Array(...ln);

                let login = [a, ...ln];    
                return login;

            getAge () {
                let now = new Date();
                let age;
                let bdayThisYear = new Date(now.getFullYear(), this.birthday.getMonth(), this.birthday.getDate());

                if (now < bdayThisYear) {
                    age = now.getFullYear() - this.birthday.getFullYear() - 1;
                } else {
                    age = now.getFullYear() - this.birthday.getFullYear();
                return age;

            getPassword () {
                let fn = this.firstName.toUpperCase();
                    fn = new Array(...fn);
                const [a, ...other] = fn;

                let ln = this.lastName.toLowerCase();
                    ln = new Array(...ln);

                let pasword = [a, ...ln, this.birthday.getFullYear()];
                return pasword;

        const _createNewUser = () => {
            let firstName = prompt("Введите имя пользователя");
            let lastName = prompt("Введите фамилию пользователя");
            let bday = prompt("Введите дату рождения в формате", "10.04.1987");

            var _strToDate = (bday) => {
                let dob = bday.split(".");
                const [d, m, y] = dob;
                let day = parseInt(d);
                let month = parseInt(m) - 1;
                let year = parseInt(y);

                let bdate = new Date(year, month, day);
                return bdate;
            let birthday = _strToDate(bday);

            const newUser = new User (firstName, lastName, birthday);
            return newUser;

        const NewUser = _createNewUser();
        const login = NewUser.getLogin();
        console.log(`Login: ${login.join('')}`);

        const age = NewUser.getAge();
        console.log(`Age: ${age}`);

        const password = NewUser.getPassword();
        console.log(`Password: ${password.join('')}`);