Help us understand the problem. What is going on with this article?


More than 5 years have passed since last update.


var diff = data.Select((x, index) => { 
  var diffX = Math.Abs(x - target);
  return new { index, diffX }; 
var targetIndex = diff.OrderBy(d => d.diffX).First().index;
基本的にはC#で開発してますが、時々でJavaScriptで四苦八苦するソフトウェア開発者。 三十路を越えてから、なぜかプログラミングへの興味が高まってます。 若い頃の趣味はスキューバやスキーのアウトドア派でしたが、子どもができてからは専らTVゲーム(特に洋ゲー好き)。洋ゲーは子どもの前ではプレイできないのがツライところ。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away