投稿時間:2023-01-14 13:06:49 RSSフィード2023-01-14 13:00 分まとめ(9件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
IT | 気になる、記になる… | 【Kindleストア】講談社の「冬電2023 キャンペーン」で新たなセールを開催中 − 全品半額セールが複数スタート | https://taisy0.com/2023/01/14/167050.html | amazon | 2023-01-14 03:09:40 |
IT | ITmedia 総合記事一覧 | [ITmedia News] フジロックのチケットが「ふるさと納税」返礼品に 長距離バスや宿泊券とのセットも | https://www.itmedia.co.jp/news/articles/2301/14/news056.html | itmedia | 2023-01-14 12:50:00 |
python | Pythonタグが付けられた新着投稿 - Qiita | 【Docker】Pythonで特定のコンテナを起動(run)する方法 | https://qiita.com/MOSO1409/items/1e857768d76bbe332c11 | docker | 2023-01-14 12:41:10 |
AWS | AWSタグが付けられた新着投稿 - Qiita | 【AWS】Congnitoを使ったログインページ作成 | https://qiita.com/grapefruit_0514/items/cf9e468c86a1aab4f03a | amazoncognito | 2023-01-14 12:46:28 |
Docker | dockerタグが付けられた新着投稿 - Qiita | 【Docker】Pythonで特定のコンテナを起動(run)する方法 | https://qiita.com/MOSO1409/items/1e857768d76bbe332c11 | docker | 2023-01-14 12:41:10 |
Git | Gitタグが付けられた新着投稿 - Qiita | どのバージョンでビルドされたかを記録するgit-commit-id-maven-pluginを使ってみる | https://qiita.com/omix222/items/9e5d6dcd1033d8614043 | gitcommitidmavenplugin | 2023-01-14 12:59:04 |
海外TECH | DEV Community | 9 Common JavaScript Interview Questions You Might Not Know The Answer For. | https://dev.to/gustavupp/9-common-javascript-interview-questions-you-might-not-know-the-answer-for-3a8g | Common JavaScript Interview Questions You Might Not Know The Answer For Whether you like them or not tricky questions are still asked by interviewers in the wild The reason is these questions can tell a lot about your core understanding of the language and therefore if you are a fit for the job Common concepts addressed in these questions include HoistingClosureScopeValue vs Reference typePrototype inheritanceToday we will kill two birds with one stone Prepare to ace your next interview and brush up on the core concepts at once Why typeof f is undefined var y if function f y typeof f console log y undefinedExplanationThe condition statement if function f returns function f which is truthy so the code executes inside the if statement typeof f returns undefined because the function f was never declared outside the if statement so it doesn t exist outside the if brackets if f It doesn t exist here This is how we would fix this code snippet var y function f declare function outside if bracketsif f f exists so we enter the if block y typeof f here typeof f is function console log y function Write an example of closurefunction createFunction msg return function name return msg name let myFunc createFunction Hey console log myFunc Dude Hey DudeExplanationThe first function createFunction returns an anonymous functionThe anonymous function returns the parameter msg from the outer function createFunction name from itself When we declare the variable javascript let myFunc createFunction Hey the variable myFunc holds a reference to the anonymous function returned by the outer What is interesting is that when you call javascript myFunc Dude passing just the name parameter it still remembers the value of msg that was passed in when createFunction was executed The ability to access variables from the outer scope where the function was created is one of the definitions of closure Learn more about closures here Write a multiply function that can be called like multiply and returns This is similar to the example above the difference being that we are retuning an additional function and invoking all of them straight away no using variables for holding references function multiply x return function y return function z return x y z multiply By invoking multiply like javascript multiply We are invoking the returned functions one after the other We could use intermediate variables to make it clearer Let s have a look let func multiply x is console log func function y return function z return x y z let func func y is console log func function z return x y z func z is finally has all values and returns their product Learn more aboute Nested Functionshere delete operator on a local variableWhat would be the output of the following code let output function x delete x return x The delete operator is meant to be used to delete properties of objects and not on value types number in this case This would work let obj name Gus age delete obj age console log obj name Gus delete operator on Objectconst Person name Gus age const person Object create Person delete person ageconsole log person Age person is created with its prototype set to the Person object When the instance emp has it s name property deleted we can still access the name property of the prototype object Person That is why it seems like it didn t work This is a big topic you can learn more here delete operator on ArrayWhat would be the result of logging arr length let arr a b c d delete arr arr length When used on arrays the delete operator sets the delete element to empty but does not remove it from the array not changing the length of the array What will be the value of both console log s var favouriteAnime Dragon Ball function console log favouriteAnime var favouriteAnime Naruto console log favouriteAnime undefined NarutoHere is how the compiler interpreted this code var favouriteAnime declared and initialized with undefined function console log favouriteAnime var favouriteAnime Naruto console log favouriteAnime favouriteAnime Dragon Ball undefined NarutoA few things to keep in mind when declaring JavaScript functions and variables Variable assignment myVar takes precedence over function declaration function func Function declarations function func take precedence over variable declarations var myVar let or constFunction declarations function func are hoisted over variable declarations var myVar but not over variable assignments myVar As a best practice you should always declare your functions before invoking them Learn more about hoisting here How would you check if a number is an integer A very simple way to check if a number is a decimal or integer is to see if there is a remainder left when you divide by function isInt num return num console log isInt trueconsole log isInt falseconsole log isInt false ConclusionRemember to hit f and try out the examples for yourself This tiny action will help you remember what you learned for much longer This is a recap of what we have seen today Why typeof f is undefined Write an example of closureWrite a multiply function that can be called like multiply and returns Delete operator on a local variableDelete operator on ObjectDelete operator on ArrayWhat will be the value of both console log s How would you check if a number is an integer Thanks for reading If you like this article Leave a comment below You can just say hi Follow me on Twitter theguspear Catch you later my dude Gus | 2023-01-14 03:32:41 |
海外ニュース | Japan Times latest articles | Fed chief urges debt limit hike, warning of U.S. default risk by early June | https://www.japantimes.co.jp/news/2023/01/14/business/economy-business/federal-reserve-us-debt-limit-warning/ | Fed chief urges debt limit hike warning of U S default risk by early JuneU S Treasury Secretary Janet Yellen said that the country will likely hit the trillion statutory debt limit next Thursday forcing the Treasury to launch | 2023-01-14 12:19:22 |
海外ニュース | Japan Times latest articles | China finds no new COVID-19 variants but mutation threat lingers | https://www.japantimes.co.jp/news/2023/01/14/asia-pacific/china-covid-dangerous-variants/ | omicron | 2023-01-14 12:03:35 |
コメント
コメントを投稿