What do you want to save?
Add Code snippet
New code examples
-
Other 2021-09-17 18:41:03
split a string into an array of characters
const string = 'hi there'; const usingSplit = string.split(''); const usingSpread = [...string]; const usingArrayFrom = Array.from(string); const usingObjectAssign = Object.assign([], string); // Result // [ 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e' ] Add solution -
TypeScript 2021-09-17 12:54:02
Write a C program to count total number of duplicate elements in an array.
/** * C program to count total number of duplicate elements in an array */ #include <stdio.h> #define MAX_SIZE 100 // Maximum array size int main() { int arr[MAX_SIZE]; int i, j, size, count = 0; /* Input size of array */ prin... Add solution -
Javascript 2021-09-17 09:44:02
10.3.1. Function Examples
/*Let's see function syntax in action. We first consider a program that prints an array of names.*/ let names = ["Lena", "James", "Julio"]; for (let i = 0; i < names.length; i++) { console.log(names[i]); } /*Followin... Add solution -
PHP 2021-09-16 07:02:02
how to validate format and size of uploaded file via php
<?php if (isset($_POST["upload"])) { // Get Image Dimension $fileinfo = @getimagesize($_FILES["file-input"]["tmp_name"]); $width = $fileinfo[0]; $height = $fileinfo[1]; $allowed_image_extension = a... Add solution -
Ruby 2021-09-16 05:00:02
ruby does object exist in array
# Element exists in array object_exists = arr.any? { |elem| elem == desired_value } # Element with property exists in array object_exists = arr.any? { |obj| obj.prop == desired_value } # Type exists in array object_exists = arr.any?(Integer) # Element ... Add solution -
Java 2021-09-16 03:06:02
Java program to insert an element at specific position in an array
import java.util.Scanner; public class InsertElement { public static void main(String[] args) { int number, position, insert; Scanner sc = new Scanner(System.in); System.out.println("Please enter number of elements in array: ... Add solution
Best helpers
Ranking is empty