投稿時間:2023-07-16 06:17:03 RSSフィード2023-07-16 06:00 分まとめ(18件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
海外TECH MakeUseOf 6 Reasons Why You Shouldn’t Leave Your PS5 Running All of the Time https://www.makeuseof.com/dont-leave-your-ps5-running-all-of-the-time-reasons-why/ great 2023-07-15 20:46:19
海外TECH MakeUseOf How Your Phone Can Be Hacked Remotely and What You Can Do to Stop It https://www.makeuseof.com/how-to-stop-phone-hackers/ think 2023-07-15 20:30:19
海外TECH MakeUseOf How to Improve Your Storytelling in Your Instagram Posts: 7 Tips https://www.makeuseof.com/how-to-improve-storytelling-instagram-posts/ instagram 2023-07-15 20:15:18
海外TECH DEV Community Demystifying Array Methods https://dev.to/noriller/demystifying-array-methods-2bml Demystifying Array MethodsSomeway somehow people think the for loops are easier to grasp and understand…I m here to change that I ll be using Javascript but most languages implement the methods in one way or another sometimes with some variance in naming BasicsMost methods with exceptions have the same signature Let s compare with the for loops const array a b c the classic for loop you can have better control over the indexed you re usingfor let index index lt array length index const element array index console log element a b c the for in gives the indexfor const index in array const element array index console log element a b c the for of gives the elementfor const element of array console log element a b c element usually this is all you need reallyindex there are uses to using the indexarray when chaining methods this allows you to use the current values in the step you re in Two things to remember are Use the best method for what you re doingIf you don t need to return anything using a map that returns will make me think you forgot to return something Likewise there are many roundabout ways that the current state of the language has better ways of doing like using findIndex when a some will do the same You can chain methodsAs long as what you return is another array then you can just do something and pass it to the next step Sometimes this makes sense but sometimes you may want to assign them to descriptive variables forEach“For each element in the array it does something and doesn t return anything a b c forEach element gt console log doesn t return anything so it s perfect for the forEach console log element a b c You use it when you just need to do something and not return anything logs toasts…It s easy to understand and use but since it doesn t return anything there aren t really many uses there are better methods for whatever you re thinking mapThe poster child of the array methods For each element in the array it returns a value note even if you don t return it returns undefined not adding in the arrow function means it returns implicitly map element gt element result array is map element gt if element remainder of the division by not equal to zero return element no else returns resulting array undefined Since it returns an array of the same size it can be used for multiple things and makes chaining easy reduceThe bane of people learning the methods…but it s not really that complicated For each element in the array it returns “one thing that can be anything Optionally you can have a starting value classical use case reduce accumulator element gt accumulator element returns classical mistake nr not returning anything reduce accumulator element gt console log accumulator initial value undefined undefined undefined because you didn t return console log element accumulator element this would be then NaN NaN number undefined NaN always remember to return something even if only the accumulator possible mistake not having an initial value no initial value means the first element is the initial value reduce accumulator element gt accumulator element retuns reduce accumulator element gt accumulator element throws because empty array with no initial value things start to be different for more complex use cases reduce accumulator element gt if element accumulator even push element else accumulator odd push element return accumulator below I m using JSDoc to type the initial value because using JS doesn t mean not using types type even number odd number even odd this returns even odd Not using an initial value will break this in multiple ways this is another way to write the same thing reduce accumulator element gt if element return accumulator even accumulator even concat element return accumulator odd accumulator odd concat element type even number odd number even odd the important thing to remember is to always return something the one thing it returns can be anything reduce accumulator element gt if element accumulator element else accumulator element return accumulator type number number this returns and would again have multiple problems without an initial valueIf you were to instantiate one or more variables outside then use a for loop or even a forEach and mutate it then it s a use case for reduce It always return “one thing and as you can see it can be anything number string array object…While you can do basically anything with reduce check if there isn t any other method that cover the case better There s also a reduceRight that is the same thing but starts from the last element filterFor each element in the array returns an array that can be of a smaller size While reduce returns “one thing filter always return an array that can be from empty to the same size of the input filter element gt element returns filter element gt element return one common use case remove falsy values map element gt if element return element at this point you would have undefined filter Boolean after this return If you want to remove values from an array filter is the method you want And for those who didn t know filter Boolean is an elegant way of removing falsy values You should be careful that it removes falsy values like empty string and zero flat and flatMapFlatting an array is not something you use every day but is certainly useful in many cases Basically to flat is to remove dimensions from an array If you have a x matrix and you flat it you end up with a simple items array map element gt return element sometimes you return values tuples depending on what you really wanted to return you just need to flat it here would return flat returns flat returns map element gt return element here would return flat Infinity returns flatting to infinity means it will remove all dimensionsYou call flat from an array and it takes a number that is how many dimensions you re stripping from it If you want a simple array as result no matter how many dimensions the array has then use the flat Infinity as it will do just that flatMap element gt return element returns returns because it flattened flatMap element gt if element return element return without returning anything it would result in undefined undefined while flatMap doesn t remove falsy values a flattened empty array disappear return returns flatMap is basically a map followed by flat TIL you can use flatMap and return for falsy values It will return just the values some and everyThose are fun ones that after learning about you will find use cases everywhere Usually the use case is either filter for something length not equal to something or Boolean find something not equal For each element in the array some returns true if at least one passes the predicate every if all passes it some element gt element true every element gt element falseOne cool thing is that they both return early some on the first truthy value returned and every on the first falsy value returned When all you need is a boolean from if there is or not something then use either some or every find and findIndexfind will return the first element that passes the predicate or undefined otherwise findIndex will return the index of the element or otherwise Both start searching from index but if you want the last of those then use the “last variations returns the element find element gt element findLast element gt element return the index findIndex element gt element findLastIndex element gt element includesSometimes you just want to check if a value exists inside an array this checks for deep equality includes true includes falseLikely we can include here indexOf and lastIndexOf both checking for a value but returning the index or otherwise indexOf indexOf lastIndexOf lastIndexOf The use case for includes is usually searching an array of primitive values string number symbols… meanwhile some and every are used for things more complex than if the value is there or not or for objects Last remarksThe MDN docs are as good as they come You might not have known all of those existed but once you do they are pretty straightforward Then again some people might know the methods exist but not how to apply them So if you want send examples you don t know how to apply the methods and I can refactor options 2023-07-15 20:07:57
海外TECH Engadget Elon Musk says Twitter’s ad revenue has dropped by 50 percent https://www.engadget.com/elon-musk-says-twitters-ad-revenue-has-dropped-by-50-percent-202600398.html?src=rss Elon Musk says Twitter s ad revenue has dropped by percentTwitter is still spending more money than it s making according to Elon Musk In the early hours of Saturday morning the billionaire tweeted the company was suffering from an ongoing negative cash flow issue due to an approximately percent drop in advertising revenue and heavy debt burden “Need to reach positive cash flow before we have the luxury of anything else Musk said We re still negative cash flow due to drop in advertising revenue plus heavy debt load Need to reach positive cash flow before we have the luxury of anything else ーElon Musk elonmusk July The admission comes in the same week that Twitter s ad revenue sharing program began paying out some creators including a handful of far right influencers On Friday Musk also claimed the social network could see “all time high device user seconds usage sometime this week He also previously said almost all the advertisers who had left the platform following his takeover in October had “either come back or “said they will come back According to an estimate research firm Sensor Tower shared with Bloomberg advertising spending fell by percent to million during a two month period earlier this year Per Reuters Twitter has annual interest payments of about billion due to the debt the company took on when Musk took it private for billion This is the latest sign the aggressive cost cutting measures Musk has undertaken in the last year have not been enough to put the company on solid financial footing It also suggests the company s newly appointed CEO Linda Yaccarino has her work cut out for her as she works to rebuild Twitter s advertising base This article originally appeared on Engadget at 2023-07-15 20:26:00
海外科学 NYT > Science Everett Mendelsohn, Who Linked Science and Society, Dies at 91 https://www.nytimes.com/2023/07/15/science/everett-mendelsohn-dead.html Everett Mendelsohn Who Linked Science and Society Dies at A longtime professor at Harvard he lectured on atom bombs genetics and more examining how science culture and politics influence one another 2023-07-15 20:11:56
海外科学 NYT > Science Dinosaur Bonebed Discovered in Maryland Park https://www.nytimes.com/2023/07/15/us/dinosaur-fossils-maryland.html different 2023-07-15 20:16:36
ニュース BBC News - Home Europe heatwave: No respite in sight for heat-stricken southern Europe https://www.bbc.co.uk/news/world-europe-66212501?at_medium=RSS&at_campaign=KARANGA mediterranean 2023-07-15 20:24:48
ニュース BBC News - Home Para Athletics World Championships: Dan Pembroke wins javelin gold with European record https://www.bbc.co.uk/sport/disability-sport/66210721?at_medium=RSS&at_campaign=KARANGA Para Athletics World Championships Dan Pembroke wins javelin gold with European recordBritain s Dan Pembroke adds the javelin world title to his Paralympic crown at the Para Athletics World Championships in Paris 2023-07-15 20:05:05
ビジネス ダイヤモンド・オンライン - 新着記事 低賃金ニッポン脱出、資格を取って海外へ!「国際系資格」の取り方・働き方・年収を大公開 - ChatGPTで激変!コスパ・タイパで選ぶ 最強の資格&副業&学び直し https://diamond.jp/articles/-/325378 chatgpt 2023-07-16 05:25:00
ビジネス ダイヤモンド・オンライン - 新着記事 夫と死別した年収276万円60歳女性、シングルマザー36歳娘の浪費に苦悩…老後は大丈夫? - お金持ちになれる人、貧乏になる人の家計簿 深野康彦 https://diamond.jp/articles/-/326160 厚生年金 2023-07-16 05:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 稲盛和夫が教える多角化経営のコツ「3つの柱だと知恵も熱意も3分の1になるが…」 - 「超一流」の流儀 https://diamond.jp/articles/-/326170 稲盛和夫が教える多角化経営のコツ「つの柱だと知恵も熱意も分のになるが…」「超一流」の流儀「経営の神様」と称された稲盛和夫氏は、事業の多角化について「企業経営者にとっては絶対条件」とまで断言しています。 2023-07-16 05:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 プレーしてよかったゴルフ場ランキング2023【東海】4位三好カントリー倶楽部、1位は? - DIAMONDランキング&データ https://diamond.jp/articles/-/325937 diamond 2023-07-16 05:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 イニエスタが最終戦で監督を“無視”した理由…人格者が見せた「もう一つの顔」 - ニュース3面鏡 https://diamond.jp/articles/-/326186 イニエスタが最終戦で監督を“無視した理由…人格者が見せた「もう一つの顔」ニュース面鏡名門バルセロナからヴィッセル神戸へ加入し、世界を驚かせてから年余り。 2023-07-16 05:05:00
ビジネス 東洋経済オンライン 金総書記の妹が《大韓民国》と括弧でくくった訳 北朝鮮流の皮肉を込めた表記で対立を深める | 韓国・北朝鮮 | 東洋経済オンライン https://toyokeizai.net/articles/-/687083?utm_source=rss&utm_medium=http&utm_campaign=link_back 大韓民国 2023-07-16 05:50:00
ビジネス 東洋経済オンライン 「文芸のプロ」が"第169回芥川賞"を独自採点・予想 「現代文学を新しく切り拓く」作品誕生となるか | 読書 | 東洋経済オンライン https://toyokeizai.net/articles/-/684606?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2023-07-16 05:40:00
ビジネス 東洋経済オンライン やまぬ芸能人への誹謗中傷が問うTwitterの功罪 ryuchellさんの死に改めて考えるSNSの攻撃性 | インターネット | 東洋経済オンライン https://toyokeizai.net/articles/-/686733?utm_source=rss&utm_medium=http&utm_campaign=link_back ryuchell 2023-07-16 05:30:00
ビジネス 東洋経済オンライン 2浪東大「浪人中にドイツ旅行させた」恩師の狙い 「ドラゴン桜2」の名キャラクターの誕生秘話 | 浪人したら人生「劇的に」変わった | 東洋経済オンライン https://toyokeizai.net/articles/-/685617?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2023-07-16 05:10:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)