Skip to content

Instantly share code, notes, and snippets.

//== Wrong way
export class User {
name: string;
age: number;
accessToken: string;
constructor(options: {
age: number;
name: string;
accessToken?: string;
const User = {
id: 123,
username: 'John',
email: '[email protected]',
addons: [
{ name: 'First addon', id: 1 },
{ name: 'Second addon', id: 2 }
]
}
Implement function `searchFile`. You give a substring, functions returns true if query satisfied to filename or false;
searchFile('crdle', 'crocodile.txt') // true
searchFile('le', 'crocodile.txt') // true
searchFile('el', 'crocodile.txt') // false
searchFile('coco', 'crocodile.txt') // true
searchFile('crdleee', 'crocodile.txt') // false
searchFile('crkdl', 'crocodile.txt') // false
Tip: `two pointers`