how to use backspace in protractor code example

Example 1: how to use backspace in protractor

describe('backspace', function() {
    it('types some stuff and backspaces one character', function() {
        element(by.model('invoice.customerName')).sendKeys('Ali Khoda');

        element(by.model('invoice.customerName')).sendKeys(protractor.Key.BACK_SPACE);

        expect(element(by.model('invoice.customerName')).getText()).toBe('Ali Khod');

    });
});

Example 2: how to use backspace in protractor

describe('backspace', function() {
    it('types some stuff and backspaces one character', function() {
        element(by.model('invoice.customerName')).sendKeys('Ali Khoda').then(function() {

            element(by.model('invoice.customerName')).sendKeys(protractor.Key.BACK_SPACE).then(function() {

                expect(element(by.model('invoice.customerName')).getText()).toBe('Ali Khod');

            });

        });

    });
});