This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/[0-9]{3}\.[\d*]{3}\.[\d*]{3}[-]?[0-9]{2}/ | |
455.423.333-24 // 455.***.***-24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mostCommonWord(paragraph: string, bannedWords?: string[]): string { | |
let invalid = new Set(["!","?","'",",",";","."," "]); | |
let banned = new Set(bannedWords); | |
// set can be a type of a array | |
let words = new Map(); | |
// map should return values and use set to config new values | |
let buffer = "" | |
let result = ""; | |
for(let ptr = 0; ptr < paragraph.length; ptr++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('-- types: undefined, boolean, number, string, object --'); | |
console.log(typeof undefined); // undefined | |
console.log(typeof null); // object | |
console.log(typeof NaN); // number | |
console.log(typeof false); // boolean | |
console.log(typeof 0); // number | |
console.log(typeof ""); // string | |
console.log(typeof []); // object | |
console.log(typeof {}); // object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface User { | |
id: number, | |
name: string, | |
[key: string]: unknown, | |
} | |
const usertype = { | |
id: 1, | |
name: 'andreia' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// difference beetween race and all | |
// ALL | |
const promise1 = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve('promise1 resolved! timeout') | |
}, 2000) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
<app-value-provider (typedValue)="recivedValue($event)"></app-value-provider> | |
<app-value-receiver *ngIf="valueOfInput" [printValue]="valueOfInput"></app-value-receiver> | |
`, | |
}) | |
export class AppComponent implements OnChanges { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type=text [value]="received some value"/> | |
<input type=text (keyUp)="emit some value"/> | |
<input type=text [(value)]="emit and received some value (update template "html" and component (ts file)"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injector // it says to angular that this service or class can be use without a parameter, | |
automatize without parameter of constructor | |
example: | |
class ServiceOrOtherClass { | |
constructor(http: httpClient) { | |
} | |
} | |
Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ngFor, ngIf says instructs for template what to do | |
I have a list, so ngFor, loop this array and show the list | |
I have this variable, if true, ngIf, show this variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sass can use directly inside @component | |
styles: [$font-size: 40em] | |
ng build doesnt need anymore of --prod flag | |
remove IE11 suppport to IE11 | |
// angular 13 |
OlderNewer