Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
Python
JavaScript
Java
C++
myFruits = ['banana','apple','orange'] myFruits.pop(1) print(myFruits) #Python
const myFruits = ['banana','apple','orange']; myFruits.splice(1,1); console.log(myFruits); //JavaScript
import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList
myFruits = new ArrayList
(); myFruits.add("banana"); myFruits.add("apple"); myFruits.add("orange"); myFruits.remove(1); System.out.println(myFruits); } } //Java
#include
#include
#include
using namespace std; int main() { vector
myFruits = {"banana", "apple", "orange"}; myFruits.erase(myFruits.begin() + 1); for(const string& fruit : myFruits){ cout << fruit << " "; } cout << "\n"; return 0; } //C++
Python result:
JavaScript result:
Java result:
CPP result:
['banana', 'orange']
banana,orange
[banana, orange]
banana orange