There was an error while loading. Please reload this page.
1 parent 0049a44 commit 681c87bCopy full SHA for 681c87b
Creational/abstractFactory.js
@@ -58,8 +58,8 @@ class ApiRequestFactory {
58
* Use this in another class making the product class
59
* and client class isolated
60
*/
61
-const availableOptions = ["tcp", "http"]
62
-const apiRequest = ApiRequestFactory.createApiRequest(availableOptions[Math.random() * 2]);
+const availableOptions = ["tcp", "http"];
+const apiRequest = ApiRequestFactory.createApiRequest(availableOptions[Math.floor(Math.random() * 2)]);
63
apiRequest.makeGetRequest("example.com")
64
.then(respone => console.log(respone))
65
.catch(err => console.log(err));
0 commit comments