投稿時間:2023-01-08 09:14:49 RSSフィード2023-01-08 09:00 分まとめ(18件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia News] ARコンタクトレンズのMojo Vision、資金不足で開発停止 マイクロLEDにピボット https://www.itmedia.co.jp/news/articles/2301/08/news037.html itmedianewsar 2023-01-08 08:18:00
Linux Ubuntuタグが付けられた新着投稿 - Qiita systemctl(systemd)を使ったジョブの定期実行と永続化 https://qiita.com/yosim/items/0b9a6f538a4eb3ebc09e centos 2023-01-08 08:47:18
海外TECH MakeUseOf JLab Launches New Silent Epic Mechanical Keyboard at CES 2023 https://www.makeuseof.com/jlab-launches-epic-mechanical-keyboard-ces-2023/ competitive 2023-01-07 23:35:15
海外TECH DEV Community Supercharge Your Skills: 7 Tips for Writing Clean and Efficient JavaScript https://dev.to/mohsenkamrani/supercharge-your-skills-7-tips-for-writing-clean-and-efficient-javascript-1gjf Supercharge Your Skills Tips for Writing Clean and Efficient JavaScriptWriting clean code is essential for every developer as it makes the code easy to read understand and maintain A clean code makes the life of everyone in the team easier your code less prone to errors and adding new features easier In this tutorial I ll cover tips so you can write much more readable code right away Before we move on remember you can build your websites on DoTenX for free With DoTenX you can visually build the front end or back end of your applications easily Use DoTenX to speed up building websites with complex databases and integrations with other services You can also use it to learn programming concepts X faster so make sure to check it out DoTenX is also open source and you can find the repository here github com dotenx dotenx Now let s start Use Proper IndentationUsing proper indentation not only makes it easier to read the code it also helps clarify the structure of the code Use consistent indentation throughout your code to improve readability and make it easier to understand Bad stylefunction getTotal items let total for let i i lt items length i total items i price return total Good stylefunction getTotal items let total for let i i lt items length i total items i price return total Use Descriptive and Meaningful Variable NamesDo yourself a favour and spend a few seconds more when you decide to add new variables especially if they re anything more than a loop counter or something like that Using descriptive and meaningful variable names can greatly improve the readability of your code Also avoid using unnecessary abbreviations as you ll definitely write code in an IDE which provides intellisence so you won t need to type in the entier variable name every time Bad stylelet a John let b Doe let c a b console log c Good stylelet firstName John let lastName Doe let fullName firstName lastName console log fullName Use CommentsUse comments and use them a lot Comments are the only way you can talk to your future self in your code so be kind to yourself and explain everything worth commenting Sometimes it s just a constant that needs clarification sometimes it s an entire function Just make sure you don t comment as you re teaching programming Every developer should know the syntax and the role of comments is to clarify the logic of the code Bad stylefunction movingAverage arr windowSize let movingAverages for let i i lt arr length i let start i Math floor windowSize let end i Math ceil windowSize if start lt start if end gt arr length end arr length let sum for let j start j lt end j sum arr j let avg sum windowSize movingAverages push avg return movingAverages Good stylefunction movingAverage arr windowSize Initialize an array to hold the moving averages let movingAverages Loop through the array of numbers for let i i lt arr length i Calculate the start and end indices for the current window let start i Math floor windowSize let end i Math ceil windowSize Make sure the start index is not negative if start lt start Make sure the end index is not past the end of the array if end gt arr length end arr length Calculate the sum of the current window of numbers let sum for let j start j lt end j sum arr j Calculate the average of the current window of numbers let avg sum windowSize Add the average to the array of moving averages movingAverages push avg Return the array of moving averages return movingAverages Avoid deep nestingIt s really difficult to read and understand deeply nested code so try to avoid it by breaking your code into smaller more manageable chunks or use a better way to implement the same logic Bad stylefunction getTotal items let total for let i i lt items length i if items i category clothing if items i color red total items i price return total Good stylefunction getTotal items let total for let i i lt items length i if items i category clothing amp amp items i color red total items i price return total Limit function parametersLimit the number of parameters you pass to your functions This tip is not about not passing the parameters the function needs to them but it s more about how you define and organise them Bad stylefunction calculateTotal items taxRate discountAmount shippingCost freeShippingThreshold Do something with the parameters Good stylefunction calculateTotal items taxRate discountAmount shippingCost freeShippingThreshold Do something with the parameters Use smaller functionsThis post is more about writing clean code and I want to avoid mixing it with concepts like SOLID principle so look at this tip from the readability perspective Do not chuck everything in a single function and try to break it into smaller pieces that are easier to understand and debug Bad stylefunction processData data let results for let i i lt data length i if data i type A results push processTypeA data i else if data i type B results push processTypeB data i else if data i type C results push processTypeC data i return results function processTypeA item Do something with item of type A function processTypeB item Do something with item of type B function processTypeC item Do something with item of type C Good stylefunction processData data let results for let i i lt data length i results push processItem data i return results function processItem item if item type A Do something with item of type A else if item type B Do something with item of type B else if item type C Do something with item of type C Use shorter lines and empty linesBreak your code into shorter lines and use empty lines to separate logical blocks you can make your code easier to read and understand Especially sometimes you might be tempted to use some cool tricks you find on StackOverflow or a blog to do something in a single line but usually they just make your code less readable Bad stylefunction add a b return a b let taxRate discountAmount shippingCost freeShippingThreshold Good stylefunction add a b return a b let taxRate let discountAmount let shippingCost let freeShippingThreshold 2023-01-07 23:01:49
ニュース BBC News - Home Ana Montes: Top spy freed in US after more than 20 years https://www.bbc.co.uk/news/world-us-canada-64200872?at_medium=RSS&at_campaign=KARANGA montes 2023-01-07 23:46:04
ニュース BBC News - Home Liverpool 2-2 Wolves: Julen Lopetegui says it is 'impossible' winner was ruled out https://www.bbc.co.uk/sport/football/64200938?at_medium=RSS&at_campaign=KARANGA Liverpool Wolves Julen Lopetegui says it is x impossible x winner was ruled outBoss Julen Lopetegui says it is impossible that Wolves had a winning goal ruled out in their FA Cup third round draw at Liverpool 2023-01-07 23:50:55
北海道 北海道新聞 イトウの生態楽しく学ぶ 北の大地の水族館で催し 北見 https://www.hokkaido-np.co.jp/article/784648/ 北の大地の水族館 2023-01-08 08:38:03
北海道 北海道新聞 旭川で住宅全焼、1人けが https://www.hokkaido-np.co.jp/article/784641/ 豊岡 2023-01-08 08:35:06
北海道 北海道新聞 ノルディック複合、山本涼太6位 W杯、男子個人第8戦 https://www.hokkaido-np.co.jp/article/784693/ 複合 2023-01-08 08:33:00
北海道 北海道新聞 2030年札幌五輪招致 札幌市民67%「反対」、全道61% 北海道新聞世論調査 https://www.hokkaido-np.co.jp/article/784671/ 世論調査 2023-01-08 08:32:06
北海道 北海道新聞 セルティック前田ら先発出場 スコットランド・プレミア https://www.hokkaido-np.co.jp/article/784692/ 先発出場 2023-01-08 08:30:00
北海道 北海道新聞 道南の高校生、大学生と食品開発 若者が敬遠する素材に光 https://www.hokkaido-np.co.jp/article/784658/ 高校生 2023-01-08 08:30:25
北海道 北海道新聞 ベルギー1部、上田はフル出場 チームは0―1で敗れる https://www.hokkaido-np.co.jp/article/784690/ 共同 2023-01-08 08:27:00
北海道 北海道新聞 南スーダン大統領失禁か映像拡散 公式行事中、報道関係者を拘束 https://www.hokkaido-np.co.jp/article/784689/ 南スーダン 2023-01-08 08:23:00
北海道 北海道新聞 レバンガ3連敗 大阪に83―91 https://www.hokkaido-np.co.jp/article/784635/ 連敗 2023-01-08 08:15:27
北海道 北海道新聞 コンサドーレ、29選手と契約合意 https://www.hokkaido-np.co.jp/article/784669/ 北海道コンサドーレ札幌 2023-01-08 08:13:07
北海道 北海道新聞 コンサドーレ、横山フィジカルコーチ退任 https://www.hokkaido-np.co.jp/article/784670/ 北海道コンサドーレ札幌 2023-01-08 08:12:41
北海道 北海道新聞 ワカサギたくさん釣れたよ 網走湖2会場で解禁 https://www.hokkaido-np.co.jp/article/784649/ 冬の風物詩 2023-01-08 08:10:03

コメント

このブログの人気の投稿

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

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

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)