for each js
const fruits = ['mango', 'papaya', 'pineapple', 'apple'];
// Iterate over fruits below
// Normal way
fruits.forEach(function(fruit){
console.log('I want to eat a ' + fruit)
});
for each js
const fruits = ['mango', 'papaya', 'pineapple', 'apple'];
// Iterate over fruits below
// Normal way
fruits.forEach(function(fruit){
console.log('I want to eat a ' + fruit)
});
foreach javascript
let words = ['one', 'two', 'three', 'four'];
words.forEach((word) => {
console.log(word);
});
// one
// two
// three
// four
foreach jas
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
foeach in js
let colors = ['red', 'blue', 'green'];
// idx and sourceArr optional; sourceArr == colors
colors.forEach(function(color, idx, sourceArr) {
console.log(color, idx, sourceArr)
});
// Output:
// red 0 ['red', 'blue', 'green']
// blue 1 ['red', 'blue', 'green']
// green 2 ['red', 'blue', 'green']
foreach js
// result.params.detail = {
// "status": true,
// "message": "",
// "params": {
// "pay_credit_remain": 115,
// "month_expiry": "15",
// "detail": [
// {
// "credit": "70",
// "create_date": "2020-10-16",
// "expiry_date": "2022-01-16"
// },
// {
// "credit": "45",
// "create_date": "2020-10-17",
// "expiry_date": "2022-01-17"
// }
// ]
// }
//}
detail = "<ul>";
result.params.detail.forEach((val) => {
detail = detail + sprintf(lang.pay_credit_detail, val.credit, val.expiry_date);
});
detail += "</ul>";
$('#pay_credit_remain').html(detail);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us