<commit_before>/**
 * the Let and var
 */

function theVar () {
    var test = 'outer var';

    if (1) {
        var test = 'inner var';
        console.log(test);
    }

    console.log(test);
}

function theLet () {
    let test = 'outer let';

    if (1) {
        let test = 'inner let';
        console.log(test);
    }

    console.log(test);
}


theVar();
console.log('-------------------');
theLet();

for (let i = 0; i < 10; i++) {
    console.log(i);
}
//console.log(i);  // error: i is not defined

// const

const user = {};

user['name'] = 'John';
user.age = 25;

console.log(user.name);
console.log(user.age);

//user = {}; // error: Assignment to constant variable

//const user.address = "x road y room"; // error
//console.log(user.address);
<commit_msg>class<commit_after>"use strict"

class User {
    /**
     * 构造方法，在new对象时会被调用
     */
    constructor (username, email, password) {
        this.username = username;
        this.email = email;
        this.password = password;
    }

    register () {
        console.log(this.username + ' is now registered');
    }

    /**
     * 定义表态方式，即类可直接调用的方法
     */
    static countUsers () {
        console.log('There are 100 users');
    }
}

let bob = new User('bob', '<EMAIL>', '<PASSWORD>');

bob.register();

User.countUsers();


/**
 * 类继承
 */

class Member extends User {
    constructor (username, email, password, memberPackage) {
        // 调用父类方法
        super(username, email, password);

        this.package = memberPackage;
    }

    getPackage () {
        console.log(this.username + ' is subscribed to the ' + this.package + ' package');
    }
}

let mike = new Member('mike', '<EMAIL>', '123', 'standard');
mike.register();
mike.getPackage();

{'fraction_non_alphanumeric': 0.18024263431542462, 'fraction_numerical': 0.007510109763142692, 'mean_word_length': 2.2803030303030303, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6455760', 'n_tokens_mistral': 610, 'n_tokens_neox': 597, 'n_words': 141}