Skip to content

Commit 681c87b

Browse files
committed
take random option
Signed-off-by: Nimit <nimitagg95@gmail.com>
1 parent 0049a44 commit 681c87b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Creational/abstractFactory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ApiRequestFactory {
5858
* Use this in another class making the product class
5959
* and client class isolated
6060
*/
61-
const availableOptions = ["tcp", "http"]
62-
const apiRequest = ApiRequestFactory.createApiRequest(availableOptions[Math.random() * 2]);
61+
const availableOptions = ["tcp", "http"];
62+
const apiRequest = ApiRequestFactory.createApiRequest(availableOptions[Math.floor(Math.random() * 2)]);
6363
apiRequest.makeGetRequest("example.com")
6464
.then(respone => console.log(respone))
6565
.catch(err => console.log(err));

0 commit comments

Comments
 (0)