Basic coding stlye

mail@pastecode.io avatar
unknown
html
a year ago
784 B
9
Indexable
<!-- 
    PascalCase 
 e.g.: css class 
-->

<!-- 
    camelCase 
e.g.: JS functions, variables
-->

<!-- HTML -->

<input class="HtmlElement__test" onclick="onClick()" />
<button>{{this.selectedItems.text}}</button>

<!-- CSS -->

.HtmlElement {
    &__test {
        display: block;
    }
}

<!-- JS -->
<!-- private fields -->

const testArray = []; //GOOD
const test__Array = []; //BAD

private selectedItems: TextValue = { text: 'Choose country...', value:-1 };

<!-- functions -->

ngOnInit(): void {

}

function  onClick(item): void {
    //implementation
    this.selectedItems = item;
}

<!-- 
    JS basic
    == > 
    ===
 -->

console.log(condition === true ? 'CLOSE': 'OPEN')

console.log(condition ? 'CLOSE' : 'OPEN');