Last active
June 1, 2020 11:57
-
-
Save diegogriep/6e3c23db9c0945869d513ad09d4c92aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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 returnLastOne<T>(param: Array<T>): T { | |
return param.pop(); | |
} | |
//ou | |
function returnLastOne<T>(param: T[]) { //implícito retorna tipo T | |
return param.pop(); | |
} | |
let showLastOne = returnLastOne(['JavaScript', 'TypeScript', 'HTML']); | |
let showLastOneNumber = returnLastOne([1, 2, 3]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment