What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-01-22 21:55:03
woocommerce gateway process payment
public function process_payment( $order_id ) { $order = wc_get_order( $order_id ); // Mark as on-hold (we're awaiting the payment) $order->update_status( 'on-hold', __( 'Awaiting offline payment', 'wc-gateway-offline' ) );... Add solution -
TypeScript 2022-01-21 23:42:02
If there are an odd number of elements in the array, return the element in the middle of the array.
public String middleElement(String[] array) { if (array.length >=1){ if (array.length %2 != 0){ return array[array.length/2]; } else if(array.length %2 == 0){ return array[array.length/2]; } ... Add solution -
Javascript 2021-11-20 11:33:23
number to array js
const myNumber = 1245; function numberToArray(number) { let array = number.toString().split("");//stringify the number, then make each digit an item in an array return array.map(x => parseInt(x));//convert all the items back into number... Add solution -
Other 2021-11-18 13:44:14
filter array object by its elements
const things = { thing: [ { place: 'here', name: 'stuff' }, { place: 'there', name: 'morestuff1' }, { place: 'there', name: 'morestuff2' }, ], }; const removeDuplicates = (array, key) => { return array.reduce((arr, item) => { ... Add solution