【Japanese】readable code part.1

Fa9a05718138d76c510e16fe3cd421b5?s=47 readalpha
September 16, 2020

【Japanese】readable code part.1

Fa9a05718138d76c510e16fe3cd421b5?s=128

readalpha

September 16, 2020
Tweet

Transcript

  1. ಡΈ΍͍͢ίʔυͱ͸ Ϧʔμϒϧίʔυ͔ΒֶͿίʔυͷॻ͖ํQBSU

  2. Ͳͬͪͷํ͕ಡΈ΍͍͢ʁ /** * αΠίϩͷ໨͕6͔ͦΕҎ֎͔Λग़ྗ͢ΔϓϩάϥϜ * ࡾ߲ԋࢉࢠύλʔϯ */ const return6orNo =

    function () { const RollTheDice =Math.floor(Math.random() * 6 + 1); let result = RollTheDice === 6 ? 'yes' : 'No'; return result; } console.log(return6orNo()); /** * ී௨ͷifจύλʔϯ */ const return6orNo = function () { const RollTheDice =Math.floor(Math.random() * 6 + 1); if (RollTheDice === 6) { return 'yes'; } else { return 'No'; } } console.log(return6orNo());
  3. lίʔυ͸ଞͷਓ͕ ࠷୹࣌ؒͰཧղͰ͖ΔΑ͏ʹॻ͔Ͷ͹͍͚ͳ͍z 伴ͱͳΔߟ͑

  4. ໊લʹ৘ใΛ٧ΊࠐΉ w ໊લ͚ͩͰͦΕ͕ԿΛ͢Δͷ͔൑அͰ͖Δˠ఺ w ໌֬ͳ୯ޠΛબͿʢಈ࡞ΛࢭΊΔɿTUPQ ˠQBVTF ։͍͍ͯΔϖʔδͷ63- Λऔಘ͢ΔɿHFU63- ˠHFU$VSSFOU1BHF63- ʣ

    w ൚༻తͳ໊લΛආ͚Δɺ΋͘͠͸࢖͏ঢ়گΛબͿʢ߹ܭֹ͕ۚ ໭Γ஋ͷؔ਺ͳΒɺSFUVSOSFUVSO7BMˠSFUVSOUPUBM"NPVOUʣ w ໊લͷ௕͞ΛܾΊΔʢ໊લ͸୹͍ํ͕͍͍͕ɺ௕͍͜ͱ͸ѱ͍͜ͱͰ͸ͳ͍ɻε ίʔϓ͕খ͚͞Ε͹୹໊͍લΛ࢖ͬͯ΋Α͍ɻάϩʔόϧม਺Ͱ͋Ε͹͔ͬ͠Γ໊ͨ͠લʹ ͢Δɻʣ
  5. ίϝϯτ͢΂͖͜ͱ w ໋໊Ͱ࣮ଶ͕Θ͔ΔͳΒɺίϝϯτ͸ඞཁͳ͍ɻ //ݱࡏͷϖʔδͷURLΛऔಘ͢Δ getCurrentPageURL();

  6. ίϝϯτ͢΂͖͜ͱ w ໋໊ͷࠅ͞ΛίϝϯτͰิΘͳ͍ɻ /** * ཁૉAͱཁૉBͷߴ͞Λ߹Θͤͨ΋ͷΛग़ྗ͢Δɻ */ function calculationHeight() {

  7. ίϝϯτ͢΂͖͜ͱ w ࢓༷Λॻ͘ɻͲͷΑ͏ͳ৚͕݅ἧ͑͹໰୊ͷͳ͍ಈ࡞Λ ͢Δͷ͔ͳͲ /** * λϒ੾Γସ͑༻ͷؔ਺ * ཁૉʹ.js-tabsΫϥεΛ෇༩͢Ε͹ɺ *

    ͦͷ௚Լͷཁૉ͸શͯλϒػೳΛ࣋ͭɻ */ function tabFunc() {
  8. ίϝϯτ͢΂͖͜ͱ w ઃܭͷϩδοΫΛॻ͘ɻಡऀʹϩʔυϚοϓΛෑ͚ΔͷͰɺ هड़ͷྲྀΕΛ೺Ѳ͢Δͷָ͕͍͢͝ʹͳΔɻ /** * ੾Γସ͍͑ͨը૾ΛpositionͰશͯॏͶɺ * ࣌ؒܦաͰͦΕͧΕͷz-indexΛͣΒ͍ͯ͘͠ɻ *

    [3,2,1,0]→[0,3,2,1]→[1,,3,2,0]ͱ͍͏ײ͡ɻ * ੾Γସ͑ͱಉ࣌ʹjQueryͷfadeIn()Λ࢖͍ͬͯΔɻ */ function switchImages() {
  9. ίϝϯτ͢΂͖͜ͱ w ίʔυͷܽؕʹίϝϯτΛ͚ͭΔɻ /** * ͜ͷؔ਺͸querySelectorAllΛ࢖͍·ͬͯ͘ΔͷͰॲཧ͕஗͍ɻ * ΋ͬͱແବͷͳ͍ཁૉऔಘΛ͢ΔΑ͏ʹϦϑΝΫλϦϯά͢΂͖ɻ * ෳ਺Օॴͷઃஔ͸ඇରԠ

    */ function tabFunc() {