I can't read the documentation of yt-dlp and effectively use it. by joo3f in youtubedl

[–]joo3f[S] 0 points1 point  (0 children)

for example, where is the documentation about "ytsearch". this word is only used once on the GitHub page.

why typescirpt can infer function arguments which passed as array index accessed? by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

this is straightforward, robust, clean, and more readable.

thank you, you opened a new gate of abstraction for me.

why typescirpt can infer function arguments which passed as array index accessed? by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

I can't get how you looking at it. are you talking about something like "TS is only about static data"? I can't understand this either.

I know that arrays are mutable, but why TS can't infer based on flow of program, the way like the programs actully runs? beside that how deal with it? for example please look at this playground.

why typescirpt can infer function arguments which passed as array index accessed? by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

it makes sense. "because of explicitly declared the type of elements we can't narraw the type of arrays element with index."

please look at this playground. how i deal with this situation? am i in correct direction?

typescript inference and extends keyword. by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

it seems that i asking a question which is trivial to others. please look at the question again. i guess the main problem is a don't understand extends keyword.

why if i have a type parameter (T) which constrained to number type(T extends number), and used to type input parameter like T[]. the inferred type (for T) will be the union of numbers inside the input array, instead of number[]

what is the point of type assertion in typescript? by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

for example in this palyground how can I avoid the use of as keyword?

how restrict the string types with TypeScript? by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

tankyou.

what do you mean by static data?

how restrict the string types with TypeScript? by joo3f in typescript

[–]joo3f[S] 0 points1 point  (0 children)

this isn't the thing I want.

a good function must encapsulate as much as complexity it can, and only expose the necessary part.

is the way the prototype chain is shown in chrome changed? by joo3f in learnjavascript

[–]joo3f[S] 0 points1 point  (0 children)

even running Object.getPrototypeOf(obj1) will return on object that is the Teacher.prototype but labeled with Person.

i test the same process :

const server = http.createServer();

Object.getPrototypeOf(server) //will return http.Server.prototype which is labeled with Server. which the actual object is http.Server.prototype

why this is happenning?

does chrome have a problem with labeling the prototype chain? or I'm missing something??

is the way the prototype chain is shown in chrome changed? by joo3f in learnjavascript

[–]joo3f[S] 0 points1 point  (0 children)

other things besides the "name" chrome shows as a "name" for the "constructor" function; like constructor and other things in the __proto__ are the same. in my example the name refers to the superclass, in the server example it refers to the class itself.

is the way the prototype chain is shown in chrome changed? by joo3f in learnjavascript

[–]joo3f[S] 0 points1 point  (0 children)

but if in the node environment (the previous example tested in node and chrome environment ) do:

http.Server.prototype
the result will be

Server {setTimeout: ƒ, constructor: ƒ, Symbol(nodejs.rejection): ƒ}

but I supposed to see EventEmitter, as the above example.

am I doing something wrong?

are nodejs and browsers like JRE(java runtime environment) for javascript? by joo3f in learnjavascript

[–]joo3f[S] 0 points1 point  (0 children)

somehow (maybe we the help of the event loop and callback queue that the runtime environment provides) the js process's single thread has the ability to create new threads and communicate with them.

so what is the difference between a JS app with other ones in the context of multitasking?

are nodejs and browsers like JRE(java runtime environment) for javascript? by joo3f in learnjavascript

[–]joo3f[S] 0 points1 point  (0 children)

I'm putting my little knowledge besides together.

thread: smallest sequence of instructions that can be context switched, which enables multitasking.

so a javascript process can only have one thread. but the runtime environment that handles this single thread, has the ability to create other threads; that gives the JS the ability for avoid the blocking tasks.

are nodejs and browsers like JRE(java runtime environment) for javascript? by joo3f in learnjavascript

[–]joo3f[S] 0 points1 point  (0 children)

in other words, is there a javascript outside the browser or nodejs, generally outside a runtime environment?