Skip to content
This repository has been archived by the owner on Sep 2, 2019. It is now read-only.

腕試し #4

Open
t-tonchim opened this issue Sep 30, 2017 · 1 comment
Open

腕試し #4

t-tonchim opened this issue Sep 30, 2017 · 1 comment

Comments

@t-tonchim
Copy link
Contributor

t-tonchim commented Sep 30, 2017

問題1

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] のような配列から順番に値を取り出してconsole.logで表示するコードをそれぞれ異なる方法で最低3つ書いてみてください。ただしconsole.log は1回しか書いてはいけません。

回答はプルリクエストを送ってください。

@t-tonchim
Copy link
Contributor Author

t-tonchim commented Sep 30, 2017

問題2 連続したXHR(Ajax)で商品情報を取得する

ajaxで受け取ったデータを元に再度ajaxでリクエストを送る練習です。2回ajaxを使用する必要があります。

https://gist.githubusercontent.com/tomoyuki-tanaka/9ca030986150706648b220a2c1a6e64f/raw/17acbba1e39a51d0fd4c29d34c5f7aef6e9f3741/quiz2_1.json にGETリクエストを送ると以下のようなjsonが帰ってきます。

{
  "item" : {
    "id" : 1234
  }
}

このjsonに含まれるidを元に以下のurlからitemの詳細(item_detail)を受け取り、console.logでitem_detailのnameを表示してください。下記urlの{item_id}の部分はitem.idで置き換えてください。

https://gist.githubusercontent.com/tomoyuki-tanaka/9ca030986150706648b220a2c1a6e64f/raw/17acbba1e39a51d0fd4c29d34c5f7aef6e9f3741/{item_id}

それぞれのjsonの情報はこちらにあります。

チャレンジ(必須ではないです)

  • 可能であればjQueryを使わない(fetchAPIを使うかその他のライブラリを使ってみる)
  • Promiseを使ってみる
  • async awaitを使ってみる

t-tonchim added a commit that referenced this issue Oct 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant